xoops forums

Forum Index


Board index » All Posts (xoopdio)




xoopdio

Just popping in
Posted on: 2012/4/30 7:50
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#1

Re: updating handler var ?

Its because you use the wrong handler son, you need to use the xoops_getmodulehandler function instead. ;)
"A tree is made of non-tree elements" Thich Nhat Hanh


xoopdio

Just popping in
Posted on: 2012/4/30 7:42
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#2

Re: global variable

http://php.developpez.com/faq/langage ... #concepts_gardervariables

for those who fall on this post. ;)

Thanks to all others contributors..
"A tree is made of non-tree elements" Thich Nhat Hanh


xoopdio

Just popping in
Posted on: 2012/4/1 13:15
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#3

updating handler var ?

Hi

I got the following object :

(Object) XoopsModelWrite     
 handler 
(Object) XoopsUserHandler         
handler 
(NULL)         
handlers (Array, 5 elements)            
 
read (NULL)            
 
stats (NULL)            
 
joint (NULL)             
write (NULL)            
 
sync (NULL)         
table (String10 characters xada_users         
keyName 
(String3 characters uid        
 className 
(String9 characters XoopsUser        
 identifierName 
(String5 characters uname        
 db 
(Object) XoopsMySQLDatabaseProxy


Id like to know if its possible to change the table name as entry, and if yes with which method ?
I already tried the setVar method from the class XoopsObject but I must do it wrong or it is not the way to proceed : I couldn't find the proper way to do this.

Thank you
"A tree is made of non-tree elements" Thich Nhat Hanh


xoopdio

Just popping in
Posted on: 2012/1/10 6:00
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#4

global variable

Hi

Id like to insert a new global variable with the following code :

include http://pastebin.com/WQmh4Zmd

the real line is of course a working link to the real file.

and insert : $var = Accessit::getInstance($xoopsDB)->getDivNamesFromDb();

but I always get a blank page in the application.

I tried to put this in the header, index or footer but it seems to block the code and I dont understand why. Maybe someone could help me to find the reason because I run out of ideas ?

Thank you
"A tree is made of non-tree elements" Thich Nhat Hanh


xoopdio

Just popping in
Posted on: 2011/11/28 5:36
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#5

Re: code interception

Quote:
Yeah annuaki




Quote:
all you have to do is edit the mainmen and usermenu block template in system.


Thanks but it's actually what I didn't want to do : I'd like to keep it simple, like in a theme installation, for the user convenience.

Quote:
'Defacer' module has a preload that is able to assign blocks to a smarty var and unset those blocks from the blocks array(so they do not show in on the blocks layout). You can look into it for ideas.


Thanks for the tip, I'll need to have a look but it seems to look more to what I need.

I actually find on the smarty forum another one which would involved a outputfilter plugin but I still need, too, to figure out how to insert it in the application.

With all that, I should work out something. Thanks again.
"A tree is made of non-tree elements" Thich Nhat Hanh


xoopdio

Just popping in
Posted on: 2011/11/24 9:56
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#6

code interception

Hello

I'd like to intercept the code, to make a treatment on the user and main menu links after that the template has made its job (fill and render the block content) but before the sending to the user.

Or in other words : I'd like to transform a link from the user menu for example from that :

<a class="menuMain " title="Private Messaging" href="http://www.xoops.try/modules/pm/">Private Messaging</a>

to this :

<a class="menuMain href="http://www.xoops.try/modules/pm/" title="Private Messaging" onmouseover="showmenu('menu_1');" onfocus="showmenu('menu_1');">Private Messaging<span> :</span></a>

All while staying in the theme modifications capabilities (without modifying code elsewhere), I thought about php dom modifications but I don't see where to place the interception.

Does anyone knows if it is possible and if yes, where can I do that ?

Thank you
"A tree is made of non-tree elements" Thich Nhat Hanh


xoopdio

Just popping in
Posted on: 2011/11/5 4:10
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#7

Re: user insertion

Thanks for the link (I just happen to see that it's far more useful with javascript enabled.. )

Quote:
and for the level attribute; level 1 is for people who are activated and level 0 is for those who are not. So everyone should be either a 0 or 1. Sometimes there are some greater than one, but the important thing is that they are greater than 0.


Ok, now it's crystal ! As I was inserting 2 as level value, I could have been waiting and coding a long time..

So now, the module behaves as expected ! I got to test it on a production server as I don't have mail function on my workstation. The next step is to get the process automatized at each registration.

With an Extra thanks to you, I guess it is solved now !

The user_add function code (if it can help someone) :

function user_add($USER_INFOS
{
         global 
$xoopsConfig;
        include (
'../../../mainfile.php');
         include_once 
XOOPS_ROOT_PATH '/kernel/user.php';
         include_once 
XOOPS_ROOT_PATH '/kernel/object.php';
         include_once 
XOOPS_ROOT_PATH '/include/functions.php';
          
$table $this->xoopsDB->prefix('users');
         
$date time();
         
$user_avatar 'avatars/blank.gif';
         
$actkey substr(md5(uniqid(mt_rand(), 1)), 08);
         
$theme 'zetagenesis';
         
$member_handler =& xoops_gethandler('member');
         
$user =& $member_handler->createUser();
         
$user->setVar('name'$USER_INFOS['NAME'], true);
         
$user->setVar('uname'$USER_INFOS['UNAME'], true);
         
$user->setVar('pass'$USER_INFOS['PASS'], true);
         
$user->setVar('email'$USER_INFOS['EMAIL'], true);
         
$user->setVar('url'$USER_INFOS['URL'], true);
         
$user->setVar('user_avatar'$user_avatartrue);
         
$user->setVar('user_regdate'$datetrue);
         
$user->setVar('user_icq'$USER_INFOS['USER_ICQ'], true);
         
$user->setVar('actkey'$actkeytrue);
         
$user->setVar('user_aim'$USER_INFOS['USER_AIM'], true);
         
$user->setVar('user_yim'$USER_INFOS['USER_YIM'], true);
         
$user->setVar('user_msnm'$USER_INFOS['USER_MSNM'], true);
         
$user->setVar('theme'$themetrue);
         
$user->setVar('bio'''true);
         
$user->setVar('uorder'$xoopsConfig['com_order'], true);
         
$user->setVar('umode'$xoopsConfig['com_mode'], true);
         
$user->setVar('level'0);        // admin activation
         
if($member_handler->insertUser($user))
         {
             
$sql 'SELECT uid FROM ' $table ' WHERE uname = '' . 
                                    $USER_INFOS['
UNAME'] . '';';             
                        
$result $this->xoopsDB->queryF($sql);
              while(
$row $this->xoopsDB->fetchRow($result))
             {                 
                                 foreach(
$row as $value)
                 {
                     
$UID = (int)$value;
                 }
             }              
                        
$XoopsMemberShip =& $member_handler->addUserToGroup(2$UID);                          // admin mail
             
$xoopsMailer =& xoops_getMailer();
             
$xoopsMailer->reset();
             
$xoopsMailer->useMail();
             
$xoopsMailer->setTemplate('adminactivate.tpl');
             
$xoopsMailer->assign('USERNAME'$user->getVar('uname'));
             
$xoopsMailer->assign('USEREMAIL'$user->getVar('email'));
             
$xoopsMailer->assign('USERACTLINK'XOOPS_URL "/modules/" 
                                      
$GLOBALS['xoopsModule']->getVar('dirname''n') . '/activate.php?id=' .                          $user->getVar('uid') . '&actkey=' $user->getVar('actkey''n'));
             
$xoopsMailer->assign('SITENAME'$GLOBALS['xoopsConfig']['sitename']);
             
$xoopsMailer->assign('ADMINMAIL'$GLOBALS['xoopsConfig']['adminmail']);
             
$xoopsMailer->assign('SITEURL'XOOPS_URL "/");             
                        
                  
$xoopsMailer->setToGroups($member_handler->getGroup($GLOBALS['xoopsConfigUser']['activation_group']));
             
$xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']);
             
$xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']);
             
$xoopsMailer->setSubject(sprintf(_US_USERKEYFOR$user->getVar('uname')));
             if (!
$xoopsMailer->send())
                        {
                 
$_SESSION['profile_post']['_message_'] = 2;
             } else {
                 
$_SESSION['profile_post']['_message_'] = 3;
             }
         } else {
             
//user not created successfully, you can perhaps get error messages with this:
             
$errors_array $user->getErrors();
         }     
}
"A tree is made of non-tree elements" Thich Nhat Hanh


xoopdio

Just popping in
Posted on: 2011/11/4 9:47
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#8

Re: user insertion

It's strange : I added the code (line 176-194) which as I understand it, is supposed to send the mail to the admin to request the activation of the user. But the user is still automatically registered, even with the level set to 2 in the database ??

I thought it should be sufficient condition for the user to have admin registration always enabled but no.. Do you know what could happen ? Or I miss (again.. ) something ?

Actually I mix up activation_type and level data, the first one seems to set the admin registration but the second, I don't see how it operates ?
"A tree is made of non-tree elements" Thich Nhat Hanh


xoopdio

Just popping in
Posted on: 2011/11/3 7:27
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#9

Re: user insertion

Thanks a lot for the piece of code !

I tested the admin autentification code but as you said it seems to need more coding, as XOOPS doesn't seem to see it as it should. Another hole that I'll have to dig up..

But I got a working code looking as it should !

Thanks again !

PS : So the first part is done : if anyone have time, you are welcomed to install and test !

The module is intended to synchronize users between XOOPS and PHPBB3, you can find it here, at BadDev's Place..

Thank you !
"A tree is made of non-tree elements" Thich Nhat Hanh


xoopdio

Just popping in
Posted on: 2011/11/2 6:14
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#10

Re: user insertion

Ok I reply to myself..

I found those bits of code here and here. So I came with that line of code :

include ('../../../mainfile.php');
include_once 
XOOPS_ROOT_PATH '/kernel/user.php';
include_once 
XOOPS_ROOT_PATH '/kernel/object.php';
$member_handler =& xoops_gethandler('member');
$user =& $member_handler->createUser();
$user->setVar('uname'$name);
$user->setVar('pass'md5('password'));
if (
$member_handler->insertUser($user))
{
    
$sql 'SELECT uid FROM ' $table ' WHERE uname = '' . $USER_INFOS['UNAME'] . '';';
            
$result $this->xoopsDB->queryF($sql);
            
            while(
$row $this->xoopsDB->fetchRow($result))
            {
                foreach(
$row as $value)
                {
                    
$UID = (int)$value;
                }
            }
        
$XoopsMemberShip =& $member_handler->addUserToGroup(2$UID);         
}else
{
        
$errors_array $user->getErrors();
}


Does the job.. Its all I ask.. :)

JCash -> thanks but I gonna stick with the memberhandler, it seems to be the right way to do. ;)
"A tree is made of non-tree elements" Thich Nhat Hanh



TopTop
(1) 2 3 »