Skip to:
Content
Pages
Categories
Search
Top
Bottom

If Admin

  • How can I determine if the user is an admin or not?

    I have the following code so far (based on a WordPress one I use):

    <?php global $bb_current_user; bb_get_current_user_info(); if ($bb_current_user->bb_user_level == 10 ) { ?><li><a title="Admin" href="http://www.paperviewmagazine.com/forums/bb-admin/">Admin</a></li><?php } ?>

    But it doesn’t quite work, I’m guessing the user level is the problem. I know I could use bb_admin_link but I want to write the url myself.

    Also how can I get the url for the profile edit page for a logged in user? so for example:

    /forums/profile/cameron/edit/

    Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)

  • zaerl
    Participant

    @zaerl

    Is it possible to return just the url for the profile edit link?


    zaerl
    Participant

    @zaerl

    I mean just the url, so like:

    [a title=Edit Forum Profile href=ENTER PHP CODE HERE]Edit Profile Link[/a]


    zaerl
    Participant

    @zaerl

    profile_tab_link(bb_get_current_user_info(‘id’), ‘edit’);

    Thanks. Weird code though. Wish bbPress was more like WordPress…


    zaerl
    Participant

    @zaerl

    I am not a native english speaker nor english is my second language of choice (italian, french, english in descending order of level of fluency reached.) I don’t know what you mean with “that spits out the anchor tag as well.”

    An anchor tag is #something at the end of an URL. That piece of code echo this:

    http://the-forum/profile/profile-name/edit

    which actually is the URL. Did you mean the path? http://pastebin.com/H8r50q4W

    @zaerl

    Just making sure you were aware that the code posted above was what I needed. Thanks.


    zaerl
    Participant

    @zaerl

    Ok. Keep in mind that building your own URL in that way isn’t a good idea. This:

    profile_tab_link(bb_get_current_user_info('id'), 'edit');

    hide all the weidness you see in the pastebin (which is actually the code of profile_tab_link with the domain name stripped away. That template function call bb_uri that takes in consideration all the settings specified in the admin panel.

    Is there a valid reason for building your own URL? I can’t find one.


    kevinjohngallagher
    Member

    @kevinjohngallagher

    No CSS identifier on it.

    No way, that I can see of adding a CSS identifier on it.

    The issue with that function, and alot of bbP stuff, is that the output is hardcoded HTML from the core.

    With this type of link it’s not really a big deal, but it’s symptomatic of asking the core for one thing (the actual URL) and getting something else in return (a HREF string with text added).

Viewing 10 replies - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.