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)

steven s 10-11-2005 01:22 AM

Quote:

Originally Posted by MarcoH64
I might have a look at it. Bump me again if i forget. :D

Bumping. Think this will work in 3.5?

Edit: I figured I'd give it a go. It seems to work.:)

axi 02-16-2006 12:25 PM

works like a dream xcept one of my primary users in that group wont get the message, why is that?? wierdf!

Marco van Herwaarden 02-16-2006 12:46 PM

If only 1 didn't get the message, the problem must be on his side.

axi 02-16-2006 02:55 PM

no no, you know how in vBulletin it shows who has been emailed, well over there.. it didnt list his name... why?? he is primary of that group.

Marco van Herwaarden 02-20-2006 10:54 AM

Sorry i don't understand you.

Warlock40 04-17-2006 06:50 PM

great hack. thought it was working on 3.5.4
but get this error when try to send out an email

Code:

Database error in vBulletin 3.5.4:

Invalid SQL:

                                SELECT user.userid, user.usergroupid, user.username, user.email, user.joindate,
                                        useractivation.activationid
                                FROM user AS user
                                LEFT JOIN userfield AS userfield ON (userfield.userid = user.userid)
                                LEFT JOIN usertextfield AS usertextfield ON (usertextfield.userid = user.userid)
                                LEFT JOIN useractivation AS useractivation ON (useractivation.userid = user.userid AND useractivation.type = 0)
                                WHERE
                1=1 AND (usergroupid = 6 OR usergroupid = 7 OR usergroupid = 50 OR usergroupid = 46 OR usergroupid = 51 OR usergroupid = 2 OR find_in_set(6, membergroupids) OR find_in_set(7, membergroupids) OR find_in_set(50, membergroupids) OR find_in_set(46, membergroupids) OR find_in_set(51, membergroupids) OR find_in_set(2, membergroupids))
                AND user.email <> ''
               
                                ORDER BY userid
                                LIMIT 0, 500;

MySQL Error  : Column: 'usergroupid' in where clause is ambiguous
Error Number : 1052


Warlock40 04-19-2006 05:04 PM

no support? No worries. removed the code from my forum. Good idea. Wish I could get it to go with 3.5.4.

tylneyt 04-25-2006 01:22 AM

Quote:

Originally Posted by MarcoH64
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.

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!

smdani 06-01-2006 10:59 AM

I’ve same problem https://vborg.vbsupport.ru/showthrea...473#post975473
MySQL Error : Column: 'usergroupid' in where clause is ambiguous
Error Number : 1052

Tylneyt I’d hoped that your add will help me but after the code modification, the problem persists
?Any idea of what I would do?
I’m running vb 3.5.0 with MarcoH64’s modification

I don’t want to undo the MarcoH64’s code edition as it is very useful in my forum, but now I can’t send mails to primarygruop members :(

Panzer Max 06-09-2006 12:50 AM

That works beautifully! One would think this would be standard issue with vB.

Thanks!


All times are GMT. The time now is 03:30 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.01866 seconds
  • Memory Usage 1,764KB
  • 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
  • (1)bbcode_code_printable
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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