1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Add-on [Paid] Forum Permission-Based User Images

Discussion in 'Resource and Add-on Requests' started by taylor_smith, Oct 18, 2011.

  1. taylor_smith

    taylor_smith Well-Known Member

    I'm hoping to persuade someone to create a plugin that designates usergroup images in the postbit based on forum permissions.

    With our current software, our staff are represented by different badges:

    [​IMG] [​IMG] [​IMG] [​IMG]

    These badges are not based on usergroups, but rather on permissions. For example, when a staff member has moderator rights in a particular forum, her username looks like this:

    [​IMG]

    However, in forums where the user has no moderator permissions, her username appears as follows:

    [​IMG]

    Occasionally, we allow normal users to mod forums for their guilds/clans. In these cases, the user has a green moderator badge in his or her guild/clan forum, but appears as a normal user everywhere else--no staff badge or title.

    In our current software, we have added the following code to the postbit template (abridged for space, but conveys the general idea):

    Code:
    <if condition="can_moderate($forum[forumid], '', $post[userid]) AND !($post[usergroupid]==6 )"><div class="smallfont"><img src ="mod.gif">&nbsp;<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a></div><else />
    <if condition="($post[usergroupid]==11 OR IS_MEMBER_OF($post, 11))"><div class="smallfont"><img src ="staff.gif">&nbsp;<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a></div><else />
    <div class="smallfont"><a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a></div>
    </if></if></if>
                    <script type="text/javascript"> vbmenu_register("postmenu_$post[postid]", true); </script>
                    <else />
                    $post[musername]
                    </if>
                </div>
    Ideally, the badges should appear in the postbit below the avatar, to the left of the username. Will pay $20 USD for a plugin that achieves this same effect in XenForo.
     
  2. taylor_smith

    taylor_smith Well-Known Member

    Looking at this code, I noticed something. Basically, if a user is one of our administrator usergroups, the template edit forces the "A" badge in all forums, regardless of whether the admin is assigned as a mod. For all non-admin usergroups, the template edit forces an "M" badge if the user is assigned as a mod. If the user is not assigned as a mod, it'll show their normal user image--either an "S" badge or no image.
     
  3. taylor_smith

    taylor_smith Well-Known Member

    Trump. Still looking to hire developer for this. Payment negotiable.
     
  4. Morgain

    Morgain Well-Known Member

    You could probably build this with a bit of help. It's 3 parts.

    PART 1 Upload your two icons to your directory \styles\default
    (check that's your image path, it's the standard one)
    then you can use this short code to link to them.

    Code:
    <img src="@imagePath/GREEN_ICON.png" / >
    this assumes the image is .png but it could be .jpg or .gif
    which will be obvious when uploading it
    be careful to use binary upload mode as I've found XF can be sensitive to that.

    PART 2 Next in the Styles and Customisation forum here ask which template to edit
    to insert an icon to the left of the username in the postbit.
    Include your helpful mockups as you did here.
    Someone will tell you it's xxxxxx template.
    Keep their post open inh a tab next to your admincp tab.

    In admincp go to Appearances/ Templates
    then put that template name in the search box.
    Your helpers/s will probably tell you to look for a specific line of code - this is your landmark.
    Click in a white area of the code in the text area (edit box).
    Use Ctrl+F on the keyboard/ enter a piece of the landmark code to find it.
    Double check the landmark line of code really matches your guide on here.

    Your helper will tell you exactly where to insert your image code.
    Use ONE of your icons just to test.
    Be careful not to disturb any commas brackets etc - anything already there.
    Click Save. If you've done anything really awful XF will protect you and refuse to Save it!

    Refresh a page that shows someone's postbit. You have so far placed this icon beside EVERYONE! so you should see it.
    If not double check you obeyed instructions exactly.
    If it creates a mess on the page panic not. Back in admincp you can use the Revert button, bottom of the template, to remove what you did.
    Ask for help. Try again.

    PART 3. Conditionals.
    Next you need to work on the conditional for each situation.
    So the conditional would run something like -
    IF this user IS MODERATOR in THIS FORUM then display ICON_GREEN
    ELSE IF this user IS NOT MODERATOR in THIS FORUM then display ICON_BLUE.

    You can ask on the coding forum for a basic conditional to insert an image
    Say you want both IF and IF ELSE to cover " is moderator" and "is not moderator"


    It feels great when you get it to work. I won't say condescending things like it's easy. Nothing is the first time. But it's not terribly difficult either.
     
  5. taylor_smith

    taylor_smith Well-Known Member

    Curse my shameful technical ineptitude, but I will give it a shot. I genuinely appreciate your insight on this matter.

    Would still pay someone for a plugin and would negotiate on the amount. Nevertheless, while I have the test forum set up, I suppose it won't matter if I break everything.
     
  6. Morgain

    Morgain Well-Known Member

    :) You won't break everything I promise
    This is your rescue if it doesn't go right.

    Revert.png

    It just strips out ALL you added and returns the template to its original state.

    Building it yourself can take several days as you get a series of bits of help.
    But it is such fun seeing what YOU do showing up!

    Bit annoying when you carefully put it in and nothing happens!
    But keep trying and asking for help.

    It can take weeks to find a persuade a coder to do it for you :(
     
  7. James

    James Well-Known Member

    Can you give me a quick overview of each badge and when it would display?
    [​IMG] - displays when user is a mod of this forum
    [​IMG] - displays when user is moderator, but not in this forum?
    [​IMG] - displays when?
    [​IMG] - displays when?

    Also, would there ever be 2 badges displayed at the same time? If a user was mod, staff, VIP and admin, would all 4 badges display?
     
  8. taylor_smith

    taylor_smith Well-Known Member

    [​IMG] - displays when user is a mod of this forum.
    [​IMG] - displays when user is in the Staff usergroup. Also displays when a user is in the Moderators usergroup, but not a mod in this forum.
    [​IMG] - displays user is in a VIP group (we give this to game developers, producers, etc.).
    [​IMG] - displays when user is in an Administrator or Forum Administrator usergroup.

    So, the main difference here relates to the [​IMG] badge. We offer guilds free forum hosting. We assign them as mods for their forums, but don't stick them in the Moderators usergroup. As a result, they see the [​IMG] badge when they're in their forum, but everywhere else on the site they appear as just a normal user. Additionally, when someone is a both a moderator and in the Moderators usergroup (i.e., they're on staff--not just some guild leader), they see [​IMG] when they're a mod in this forum and [​IMG] when they're not.

    Honestly, if this is this too difficult to do, I would be content with just some instructions for adding images to usergroups. I think our guild mods can deal with not having a [​IMG] by their name. Also, the harder this gets to do, the less attached I am to the idea that mods see [​IMG] in their forums but [​IMG] otherwise. I'm really starting to lean in this direction. -_-

    I found this: http://xenforo.com/help/user-group-styling/. I'll give it a try, in case the above is too difficult to be worth it.
     
  9. James

    James Well-Known Member

    Quick question:
    Would you want multiple badges to display? Let's say you have a guild moderator who is also a VIP member, would you want M and V to appear next to their name, or would you prefer just one of them?
     
  10. taylor_smith

    taylor_smith Well-Known Member

    Nah, just one. In order of preference, I'd say:

    1 - Administrator
    2 - VIP
    3 - Moderator
    4 - Staff
     
  11. James

    James Well-Known Member

    I've got most of this done, but I'm off to play Snooker.

    Will finish later.
     
    M@rc likes this.
  12. James

    James Well-Known Member

    I've got this working great, except for one minor flaw that I'm hoping to sort out.

    When you're a moderator, it shows you with the Green M all over instead of just in that specific forum.

    EDIT: OK now I've got it working in a way where you have to be a moderator of a specific node ID (i.e. not a parent) in order for it to work.

    Will try and rewrite my moderator function tomorrow.
     
    Fuhrmann and M@rc like this.
  13. The Dark Wizard

    The Dark Wizard Well-Known Member

Share This Page