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)

s.blair 06-13-2006 02:45 PM

I've tried this hack, but when I only select an Additional Usergroup that only has 6 people in it, it instead emails all 1600 users.

Running v3.5.4 here with the hacks as listed by Marco and tylneyt.

I had to leave these lines below commented out as otherwise they would cause the crash smdani was seeing above.

$condition .= ' AND (' . implode(' OR ', $u_condition) . ')';
unset($u_condition);

Any help??

Thanks.
Scott

Warlock40 07-21-2006 05:02 PM

Quote:

Originally Posted by tylneyt
there needs to be a line added for 3.5.4, then it works just fine:

REPLACE by:
PHP Code:

// Start hack MarcoH64 
    
if (is_array($user['usergroupid']) OR is_array($user['membergroupids'])) 
    { 
// for emails
// start addition, by tylneyt
// this line is necessary to create the variable in this scope
//
        
$u_condition = array();
// end addition 
        
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 


hope that helps, should actually be a standard feature of next vB if you ask me!

Thanks for the update. I'm going to wait for 3.6 stable before I tackle this one again. I still love the idea and agree it should be a standard option in VB.

makaiguy 08-16-2006 11:29 PM

Now that 3.6.0 is out, does anybody have any experience with this hack in 3.6.0?

johnmont 08-24-2006 05:04 PM

I had to do this for 3.5.4 -- its also apparently good practice to add intval to the condition....

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[] = "{$prefix}usergroupid = " intval($id);
            } 
        } 
        if (
is_array($user['membergroupids'])) 
        { 
            foreach(
$user['membergroupids'] AS $id
            { 
                
$u_condition[] = "FIND_IN_SET('" intval($id) . "', {$prefix}membergroupids)";
            } 
        } 
// End hack MarcoH64 



All times are GMT. The time now is 03:17 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.01872 seconds
  • Memory Usage 1,743KB
  • 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
  • (2)bbcode_php_printable
  • (1)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
  • (4)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