SMF Integration, forum members aren't "registered users" SMF Integration, forum members aren't "registered users"
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

SMF Integration, forum members aren't "registered users"

Started by BryanS, March 18, 2008, 01:37:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BryanS

I have had a SMF installation and Coppermine installation running for a while and decided to finally integrate them.  I ran through the bridge manager in Coppermine and everything seemed successful.  I chose not to import my groups from SMF so Coppermine just has the groups administrator, guest, registered, and banned.  My SMF installation has several post based groups and several non post based groups, such as global mod, staff, Officer, etc.  I went into phpMyAdmin and changed the user_ids so that the users would be associated with the correct personal albums - no problems there.

I've found that SMF members that have non post based roles, like global mod, can't see albums that are setup to be visible to "registered" members in Coppermine.  SMF members that don't have a non post based role and are just post based can see these albums however.

Is there something I might have done wrong, or some way to allow SMF users with non post based roles to see these albums as well?

BryanS

The URL to my gallery is www.hoosierhooligans.org/gallery
The forum URL is www.hoosierhooligans.org

I created a test account
The user id is "tester"
The password is "test"

BryanS

Okay, so I was having an issue with some membergroups not having the upload button accessible to them with it configured as above.  I redid the bridge with the membergroups from SMF.  Now Coppermine shows all of the groups from SMF, like staff, moderator, local mod, sponsor, etc, as it's membergroups too.  All of the membergroups have access to the upload button but members belonging to non-post based groups, like moderators, still can not see albums that are configured to only be visible to "registered members."

I'd like to be able to configure some albums so that they are not visible to guests.  I think "registered members" is the group that should be allowed access to accomplish this.  Am I doing something wrong here?

Nibbler

Look in the SMF members table at the people who don't have access and determine what number they have set for ID_GROUP. Then edit the smf bridge file here


if ($user_settings['ID_GROUP'] == 0){


and add in that new number, eg. if it was 123:


if ($user_settings['ID_GROUP'] == 0 || $user_settings['ID_GROUP'] == 123){


Please report back so this can be fixed permanently.

BryanS

Thanks.... I'll give it a try and report back.  After I change the smf bridge file do I need to rerun the bridging operation or should it just work immediately?

BryanS

Having not rerun the bridge manager, I did make the above change for one of the user groups.  It didn't make any difference for members of that group - they still can't see the album restricted to "registered" users.

my current bridge file has this code (along with other code that came with it)
        function get_groups($row)
        {
                global $user_settings;

                $i = $this->use_post_based_groups ? 100 : 0;
$data = array();

                if ($user_settings['ID_GROUP'] == 0 || $user_settings['ID_GROUP'] == 2){
                        $data[0] = 2;
                } else {
                        $data[0] = $user_settings['ID_GROUP'] + $i;
                }

                if ($user_settings['additionalGroups']){

                        $groups = explode(',', $user_settings['additionalGroups']);

                        foreach ($groups as $id => $group){
                                   //$data[$id] = $group+$i; This was overwriting the primary group
                                $data[] = $group+$i;  //appends additionalGroups to the primary group.
                        }
                }

                if ($this->use_post_based_groups) $data[] = $user_settings['ID_POST_GROUP'] + $i;

                return $data;
        }

        function collect_groups()
        {
                // Use this version to exclude true post based groups
                //$sql ="SELECT * FROM {$this->groupstable} WHERE minposts=-1";

                // Use this version to include all SMF groups
                $sql ="SELECT * FROM {$this->groupstable}";

                $result = cpg_db_query($sql, $this->link_id);

                $udb_groups = array(1=>'Guests', 2=>'Registered');

                while ($row = mysql_fetch_assoc($result))
                {
                        $udb_groups[$row[$this->field['grouptbl_group_id']]+100] = utf_ucfirst(utf_strtolower($row[$this->field['grouptbl_group_name']]));
                }

                return $udb_groups;
        }


I thought the collect_group function might have something to do with what's going on as well.

For the above code, I added the line that includes membergroup ID 2 in the first if statement.  This is the group id for moderators in my smf membergroup table.


Maybe I should rerun the bridge manager?

BryanS

Okay, so I'm a dumbs*&t.  The modification worked as I typed it above.... when I ftp'd the new file to the server I forgot that I had turned off write permission for that folder and it didn't like my upload, so I didn't actually get the modified file to the server. 

I have member groups with IDs ranging from 0 (for post based members) to 16 (for non post based members) and there are missing numbers since I've removed and added user groups over the course of time. 

I imagine that the user group for a guest would come up as null.  Maybe if the if statement used greater than or equal to 0 to decide, or used not null to decide, then it would work better?  As it is now, I'll have to add each user group into this manually and updating will be a pain.  I wish I knew more about php... :(

BryanS

Okay, so I think I found a solution that will always work and not need to be maintained.  If I just changed the == 0 to >=0 then the admin users didn't have admin rights in the gallery...  So, being that the admin role should generally be user_id 1 in SMF, I used the following code, and it works flawlessly

if ($user_settings['ID_GROUP'] == 0 || $user_settings['ID_GROUP'] >= 2){