Announcement

Collapse
No announcement yet.

Read Additional Usergroups

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Read Additional Usergroups

    Hey there, I have some code i'm using that's checking usergroups using the following conditional:

    if ($vbulletin->userinfo['usergroupid'] == '6' or $vbulletin->userinfo['usergroupid'] == '7' ) ...

    Unfortunatly, this only checks against their primary usergroup. What statement do I need to check a user's Primary or Additional user groups at the same time?


    rob

  • #2
    You can use the is_member_of() function.
    Best Regards
    Colin Frei

    Please don't contact me per PM.

    Comment


    • #3
      That worked, thank you. How can I query how many posts a user has?

      Thank you. Rob

      Comment


      • #4
        You can run this database query:

        SELECT posts FROM user WHERE userid = X;
        Best Regards
        Colin Frei

        Please don't contact me per PM.

        Comment


        • #5
          Originally posted by Colin F
          You can run this database query:

          SELECT posts FROM user WHERE userid = X;
          Can you point me in the direction of how to retrieve this from a normal php page? Do I need to go through opening the database, doing a mysql_query etc?


          rob

          Comment


          • #6
            What do you mean a 'normal php page'?

            You can run queries in the SQL tab in phpMyAdmin, Or to run queries from the Admin CP:

            Admin CP -> Maintenance -> Execute SQL Query -> Manual Query

            Then enter your query in the Manual Query box and click on 'Continue'.

            To run queries you first need to give yourself permission to run queries in the Admin CP. To do this, edit this section of config.php:

            // ****** USERS WITH QUERY RUNNING PERMISSIONS ******
            // The users specified here will be allowed to run queries from the control panel.
            // See the above entries for more information on the format.
            // Please note that the ability to run queries is quite powerful. You may wish
            // to remove all user IDs from this list for security reasons.
            $canrunqueries = 'x';

            ...with x being your userid number.
            Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
            Change CKEditor Colors to Match Style (for 4.1.4 and above)

            Steve Machol Photography


            Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


            Comment


            • #7
              Hey Steve,

              Thanks for the reply. I actually am trying to use an existing, or if neccessary create a new php function that I can use to grab the number of posts a given user has.

              The first part was to verify the use was in a given group, now I want to be able to tell them how many posts they have.

              Comment


              • #8
                Colin provided that query and I provided the methods to run that query. What do you still need?
                Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                Change CKEditor Colors to Match Style (for 4.1.4 and above)

                Steve Machol Photography


                Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                Comment


                • #9
                  If you have a vBulletin session open, you can check for the amount of posts the viewing user has, using this variable:
                  $vbulletin->userinfo['posts']

                  There's no function to get the posts for a specific user though.

                  I recommend you ask for further help with custom coding on www.vbulletin.org though, as we can't really support that here.
                  Best Regards
                  Colin Frei

                  Please don't contact me per PM.

                  Comment


                  • #10
                    Originally posted by Colin F
                    If you have a vBulletin session open, you can check for the amount of posts the viewing user has, using this variable:
                    $vbulletin->userinfo['posts']

                    There's no function to get the posts for a specific user though.

                    I recommend you ask for further help with custom coding on www.vbulletin.org though, as we can't really support that here.
                    Aha. This is what I wanted, thank you. Sorry for the confusion. Is there a nice list of arrays like userinfo and their indexes like posts and usergroupid with explanations of what goes to what?

                    rob

                    Comment


                    • #11
                      No, there's no such list.
                      Not all the variables are available in all the scripts either, so it's not really possible to make such a list.
                      Best Regards
                      Colin Frei

                      Please don't contact me per PM.

                      Comment


                      • #12
                        How about for the userinfo array? Is there a vb file I can look at to get an idea for what other info is available in there?

                        rob

                        Comment


                        • #13
                          You can print_r() the userinfo array.
                          I don't know of a file that has a listing of all the data stored in this array.
                          Best Regards
                          Colin Frei

                          Please don't contact me per PM.

                          Comment

                          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                          Working...
                          X