Author Topic: New Item: Add membergroup  (Read 22239 times)

Offline Golovior

Re: New Item: Add membergroup
« Reply #15 on: August 27, 2009, 04:52:54 am »
Thanks to TimeVortex i got it working again. Thanks for that!!

Offline Nico

Re: New Item: Add membergroup
« Reply #16 on: December 22, 2009, 04:14:37 am »
Thanks to TimeVortex i got it working again. Thanks for that!!

Can you tell me how you solved this?
I have the same problem

Offline Nico

Re: New Item: Add membergroup
« Reply #17 on: December 25, 2009, 12:44:33 am »
Bump!

Anybody?
Plz!

Offline DracoGuard

Re: New Item: Add membergroup
« Reply #18 on: December 25, 2009, 03:58:19 pm »
No one even works on SMF shop anymore.  I've had support requests and ideas in for a week or more and no replies whatsoever.  I'm pretty much going to give up soon.

Offline Nico

Re: New Item: Add membergroup
« Reply #19 on: December 25, 2009, 10:09:09 pm »
I think you are very wrong about that.
There is a new update for the new forum version, so that means it is still used.

The problem is more that there is few support and/or community.
Once the system is running nice on their forums, nobody cares about the further development of things.

It is the only working credit controlled mod.
Nevertheless is still love it.

Offline DracoGuard

Re: New Item: Add membergroup
« Reply #20 on: December 25, 2009, 11:22:39 pm »
I still love it too but i'm getting absolutely no support at all.

Offline macphisto

Re: New Item: Add membergroup
« Reply #21 on: September 18, 2010, 09:46:17 am »
Here the code fixed:

Code: [Select]
<?php
//File: AddMembergroup.php
//      Item

//DATE: Mar 07, 2007
//Author Taj

class item_AddMembergroup extends itemTemplate {
    function 
getItemDetails() {
       
$this->authorName "Taj";

   
$this->authorWeb "http://www.hostadore.com/";

   
$this->authorEmail "admin@hostadore.com";
   
        
$this->name "Add Membergroup";
        
$this->desc "Allows you to add yourself to a membergroup!";
        
$this->price 1;

        
$this->require_input false;
        
$this->can_use_item true;
    }

    function 
getAddInput() {
   global 
$db_prefix;

   
$selectBox '<select name="info1">';

   
// Get all non post-based membergroups
   
$result db_query("SELECT ID_GROUP, groupName
                     FROM 
{$db_prefix}membergroups
                     WHERE minPosts = -1"
,
                  
__FILE____LINE__);
   
   
// For each membergroup, add it to the list
   
while ($row mysql_fetch_assoc($result)) {
      
$selectBox .= "<option value='{$row['ID_GROUP']}'>{$row['groupName']}</option>";
   }

   
$selectBox .= "</select>";
        return 
"Membergroup: ".$selectBox;
    }
       

    function 
onUse() {
        global 
$db_prefix$ID_MEMBER$item_info;

$additionalGroups mysql_fetch_array(db_query("SELECT `additionalGroups` FROM {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__),MYSQL_ASSOC);

if(
$additionalGroups['additionalGroups']) {
   
$additionalGroups['additionalGroups'] = $additionalGroups['additionalGroups'].",".$item_info[1];
} else {
   
$additionalGroups['additionalGroups'] = $item_info[1];
}   

echo 
$additionalGroups['additionalGroups'];          
        
$result db_query("UPDATE {$db_prefix}members SET additionalGroups = '{$additionalGroups['additionalGroups']}'
                 WHERE ID_MEMBER=
{$ID_MEMBER}",__FILE____LINE__);

        return 
"You have joined new membergroup {$item_info[1]}!!";
    }
}
?>

Thanks to Sakuragi: http://smfshop.com/forum/index.php/topic,659.msg3505.html#msg3505

I just made what he said and it works fine.

Bye.

Offline Forero

Re: New Item: Add membergroup
« Reply #22 on: November 21, 2010, 12:42:52 am »
hi there.. i got this error:

Fatal error: Call to undefined function db_query() in /home/public_html/Sources/shop/items/AddMembergroup.php on line 30

when try to use it.

my SMF version is 2.0RC3, please can modify?

Offline PREY_MX

Re: New Item: Add membergroup
« Reply #23 on: November 27, 2011, 12:22:06 am »
Igualmente tengo el mismo problema y me interesa mucho el item.

Yo pienso que el error esta aqui:
Ejemplo para SMF 1.1

Code: [Select]
$result = db_query("SELECT ID_GROUP, groupName
                     FROM {$db_prefix}membergroups
                     WHERE minPosts = -1",
                  __FILE__, __LINE__);

Ejemplo para SMF 2.0
Code: [Select]
// Get all the topics in board 1
$result = $smcFunc['db_query']('', "
SELECT t.id_topic, m.poster_name, m.subject
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE t.id_board = {int:id_board}
LIMIT 10",
array(
'id_board' => 1,
));

¿Quedaria asi el nuevo codigo para addmembergroup en SMF 2.0?:
Code: [Select]
   // Get all non post-based membergroups
   $result = $smcFunc['db_query']('', "
   SELECT id_group, group_name
   FROM {db_prefix}membergroups
   WHERE min_posts = -1",
   );


Mas lineas de codigo necesitan nuevos comandos.
RE-FIX este item please.

MAS INFO (Changes in SMF 2.0 ):
http://docs.simplemachines.org/index.php?topic=1433.0#post_db

The main functions are listed below:
Quote
Function used in SMF 1.1
db_query
mysql_fetch_assoc
mysql_fetch_row
mysql_num_rows
mysql_free_result
mysql_real_escape_string or mysql_escape_string   

SMF 2.0 equivalent
$smcFunc['db_query']
$smcFunc['db_fetch_assoc']
$smcFunc['db_fetch_row']
$smcFunc['db_num_rows']
$smcFunc['db_free_result']
$smcFunc['db_escape_string']
« Last Edit: November 27, 2011, 12:37:58 am by PREY_MX »