Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » newbie sorry....
newbie sorry....
newbie sorry....
hello,
im new with metamod, i've joomla 3.1.5 and the free edition of metamod
im using the lumiere template from rockettheme.
what i want is:
show a module when specific user (1 of the consultants) is logged in at my joomla so that an module comes into position place like showcase a,b,c,d,e or f and is vissible for all visitors!
and when they are logged-out that the module disappears for all visitors
i've tried a test for myself but im totally noob with php!
tried with (my joomla user id-number) user id: 535 username: Johan and the module number: ID:512
this is what i've filled in the module:
module place of this is showcase A!
basic options:
MetaMod v3.14, 2013-04-29
MetaMod Pro is not installed
JomGenius v14 is provided by MetaMod
Donate with PayPal Make a donation — support further development of MetaMod!
Debug: on
Start date/time (freeform): nothing
End date/time (freeform): nothing
Time zone: Amsterdam
Show Quick module(s) to: All users
$language handling: Browsers preferred language
Preferred list of languages: nl-nl
Strict language comparison: off
Style for included modules: Overruled
Style override for included modules : nothing
Auto-enable included modules?: Modules specified by ID
Quick module position or id include: nothing
php:
if ($user->id == 535) return 512; else return
can't get it to work....
this is viewable at : http://spirituelehulp.com/mediums
i really appriciate if you can help me out with this
the most likeable thing would be that when user 1 is logged in and the personal module shows up on position showcase a and when a second or more are logged in that they automatically goes to the next free position so that the row is filled from left to right.... don't know if that is possible?
hope you ccan help me i want to pay also for any help with this its really important to us..... nicer would be that the module shows up on the status of the phone consultants so that when some one is free for calling they shows up on top, and the people who are zalling at the moment shows up beneath the free people....
can you please take a look at this?
best regards,
johan verweij
p.s. my english isn't that well so hope you'll understand what i mean
Re: newbie sorry....
Hi Johan,
yes, you can do this in MetaMod, but not quite the way you were doing it. Using $user->id refers to the person viewing the page, not to whether a different person is logged in or not.
However it's still possible to get that information.
Here's a page describing the technique:
http://www.metamodpro.com/metamod/recip … -logged-in
In your scenario, we'll associate each admin user with a module to be shown for that user. The users will get put into module positions sequentially - see the 1st 3 lines in the example below to see the parts that you need to set up.
$usernames_to_detect = array('bob','jane','mary','joe');
$modules_for_users = array(55,56,57,58); // the module ids to be shown for for bob, jane, mary and joe
$module_positions = array('showcase-a','showcase-b','showcase-c','showcase-d');
$query = "SELECT username "
. " FROM #" . "__session WHERE guest = 0 "
. " AND client_id = 0 ;" ;
$db->setQuery( $query );
$found = $db->loadColumn();
$mod_counter = 0;
$mods_to_return = array();
foreach($found as $name) {
$index = array_search($name, $usernames_to_detect);
if ($index !== false) {
$changes->mod($modules_for_users[$index])->setPosition($module_positions[$mod_counter]);
$mod_counter++;
$mods_to_return[] = $modules_for_users[$index];
}
}
return $mods_to_return;
Now, I haven't actually tested this but think it should work :-) If you have trouble with it please get back to me.
Re: newbie sorry....
filled in at php what you wrote and changed it to the usernames and module ids for my modules.... but it wont get to work what could be wrong?
here's the link so you can see the option content is coming up.... but i want a module to show not content....
it's not that simple i think.
https://spirituelehulp.com/nieuw-homepage
here yoyu can see the outcome but i don't see the modules on place when im logged in or out there is nothing happening
the module titel is Metamod
position is showcase-a
this is what i filled in at php:
$usernames_to_detect = array('Johan','Carl','christel','marleen','haya');
$modules_for_users = array(521,513,514,515,516); // the module ids to be shown for for bob, jane, mary and joe
$module_positions = array('showcase-a','showcase-b','showcase-c','showcase-d','showcase-e','showcase-f');
$query = "SELECT username "
. " FROM #" . "__session WHERE guest = 0 "
. " AND client_id = 0 ;" ;
$db->setQuery( $query );
$found = $db->loadColumn();
$mod_counter = 0;
$mods_to_return = array();
foreach($found as $name) {
$index = array_search($name, $usernames_to_detect);
if ($index !== false) {
$changes->mod($modules_for_users[$index])->setPosition($module_positions[$mod_counter]);
$mod_counter++;
$mods_to_return[] = $modules_for_users[$index];
}
}
return $mods_to_return;
hope you can help me?
maybe it's better to write a step by step plan how to achieve this?
best regards,
johan
Re: newbie sorry....
Hi Johan,
are the module positions correct? e.g. showcase-a etc?
Also, are the usernames exactly correct? They should correspond to the login names not the "full" names.
If you can confirm those, I'll do a little more testing on my end and check that the rest of the PHP is accurate.
Note: this method of doing it also requires the Pro version of MetaMod. Are you using Pro?
Thanks,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » newbie sorry....
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Posts this week:
- 2
- User Info:
- Total Users:
- 7630
- Newest User:
- welch84998
- Members Online:
- 0
- Guests Online:
- 103
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked