vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Convert Secondary UserGroup to Primary UserGroup (https://vborg.vbsupport.ru/showthread.php?t=73782)

JustAskJulie 01-04-2005 09:51 PM

Convert Secondary UserGroup to Primary UserGroup
 
I'm looking for an easy way to convert a secondary usergroup to the primary usergroup for a group of members. All are in the same usergroup, but are currently listed as secondary users. In order to be able to build a mailing list or mail the users, they have to be listed as primary users of the group, so I need to know how to convert their primary usergroup.

They are currently listed as primary usergroup: Registered
with secondary usergroup: Club Owner

I need their primary usergroup to be Club Owner.

Marco van Herwaarden 01-05-2005 03:30 AM

If people in this group have a custom usertitle of for example Club Owner, you might wanna select on that.

JustAskJulie 01-05-2005 09:02 PM

Quote:

Originally Posted by MarcoH64
you might wanna select on that.

Not sure what you mean.

JustAskJulie 01-05-2005 09:33 PM

I figured out what you mean, you can build a mailing list based on a user title. I tried that and out of about 200 users that are in that user group (both primary and secondary users) that pulled about 69 (about 9 more than are listed as primary users) :(

I need some way to just convert all those secondary users to primary users, short of going through each one individually and doing it by hand.

Marco van Herwaarden 01-05-2005 09:34 PM

I mean that you can select on the user title when generating a mail list, so if this group got a unique user title, you could use that to select the members for the mailing.

Marco van Herwaarden 01-06-2005 04:09 PM

I got a better solution for you :D

Do the following modifications in your includes/adminfunctions_user.php (2 edits) and you will be able to select your users for the mailing also based on secondary membergroups.

In file includes/adminfunctions_user.php

Find:
PHP Code:

        print_membergroup_row($vbphrase['primary_usergroup'], 'user[usergroupid]'2$userarray); 

Add under:
PHP Code:

        // Start hack MarcoH64
        
print_membergroup_row($vbphrase['additional_usergroups'], 'user[membergroupids]'2$userarray);
        
// End hack MarcoH64 

In the same file find:
PHP Code:

    if (is_array($user['usergroupid']))
    { 
// for emails
        
foreach($user['usergroupid'] AS $id)
        {
            
$u_condition[] = "usergroupid = $id";
        } 

REPLACE by:
PHP Code:

    // Start hack MarcoH64
    
if (is_array($user['usergroupid']) OR is_array($user['membergroupids']))
    { 
// for emails
        
if (is_array($user['usergroupid']))
        {
            foreach(
$user['usergroupid'] AS $id)
            {
                
$u_condition[] = "usergroupid = $id";
            }
        }
        if (
is_array($user['membergroupids']))
        {
            foreach(
$user['membergroupids'] AS $id)
            {
                
$u_condition[] = "find_in_set($id, membergroupids)";
            }
        }
        
// End hack MarcoH64 

As usual test first on a test board, only limited tested by me.

Marco van Herwaarden 01-08-2005 07:26 AM

No feedback? Did this solve your problem?

JustAskJulie 01-10-2005 03:45 PM

Thanks, I'll give it a try.

trulylowcarb 03-04-2005 10:15 PM

I tried another hack for this that didn't work; I will try yours soon and will definitely come back with feedback. This is a much-needed feature... I can't believe it's not part of VB, for some reason I was under the impression it was, - right up until I actually needed it... what a rude awakening that was.
I have already changed the one group by hand, 224 of them, but I would still like to be able to email other now-secondary groups....
cross everything! :D

I got
Quote:

Parse error: parse error, unexpected T_ELSE in /includes/adminfunctions_user.php on line 279
when I tried to Send mail ...

Running vb3.07 and CMPS 1.0...1? (newest one...)

Marco van Herwaarden 03-05-2005 09:05 AM

I think you missed something in the second change in the file.

Please double check you edit


All times are GMT. The time now is 02:49 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01879 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete