Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Can metamod work with CB subs?
Can metamod work with CB subs?
Can metamod work with CB subs?
Hi-
Metamod rocks, thanks for the great module.
CB Subs is a plugin for community builder that allows for multiple profile types, payments, etc.
I need to use it with CB subs to swap modules based on subscription type (teachers get one module, students get another). Do you have any recipes for that?
I also would like to use it as a redirection tool to set up different homepages based on subscription type (when logged in if students go back to example.com/index.php they get redirected to example.com/students, etc)
Thanks!
Re: Can metamod work with CB subs?
Hi Hathwaytech,
I notice on their site that there's a plugin for CB Subs called Content Integration Plugin, which is supposed to be able to show modules based on CB Subs plans. Have you tried that already?
Because CBSubs is a commercial system I can't very easily download it to work on a recipe for you. It's impossible for me to guess what database structure is used - and since the component is apparently encoded, looking at the database tables is likely the only way to find out how everything links together.
If you like I'd be happy to log into your site to take a look and see if I can work out the database structure, so that MetaMod can query it too. Then I could make some general recipes for other CBSubs users. "PM" me with login details if you'd like me to do that.
Thanks,
Stephen
Re: Can metamod work with CB subs?
PM Sent, thanks!
As for swapping modules based on subscription type, that is easy to do within CB subs through the integration plugin as you discussed. I am more concerned about redirection based on profile type. The primary issue I have is redirection based on user type (so if they go back to the main homepage after being logged in I can redirect type1 users to type1homepage, type2 to type2homepage, etc).
Do you have any ways to access standard CB fields for redirection? CB subs also has a feature that will automatically fill out a certain field based on user type. You simply create a select list field with an option value for each type, and the system will fill it out for you upon registration. Then we would only need a way to say "if the user has type1 selected as the option for the cb_profiletype field, redirect to type1homepage".
Thanks!
Re: Can metamod work with CB subs?
Give a man enough time and he will figure it out. I combined the redirection and standard community builder recipes along with the custom field set per subscription type, and the redirection works just fine:
Code:
$user_id = $db->getEscaped((int)($user->id));
if ($user_id > 0) {
$query = "select * from #__comprofiler where user_id = '$user_id';";
$db->setQuery( $query );
$row = $db->loadObject();
/* you can now get hold of state, phone, fax, website,
* location, or whatever else they enter. All optional fields
* like this get prefixed with "cb_" (see below).
*/
// find profile type
$profiletype = $row->cb_profiletype;
// send user to page based on profile type
$app = &JFactory::getApplication();
if ( $profiletype == "Tenant" )
$app->redirect("http://www.example.com/index.php?option=com_jreviews&Itemid=1");
elseif ( $profiletype == "Landlord" )
$app->redirect("http://www.example.com/index.php?option=com_content&view=article&id=97&Itemid=181");
elseif ( $profiletype == "Advertiser" )
$app->redirect("http://www.example.com/index.php?option=com_content&view=article&id=99&Itemid=185");
}
This works fine as is, however it raises some particular issues:
1. It would be better to access #__cbsubs_subscriptions directly instead of via the custom CB field. #__cbsubs_subscriptions has two relevant fields for this (plan_id and user_id). Any ideas on some quick code for this?
2. It would certainly be better to redirect to a menu item rather than a url. How would we go about doing this? Redirection to URL works fine when you set it up, but if you change the menu item it refers to, you will need to change the PHP in metamod too. This certainly applies to the normal redirect you discuss on http://www.metamodpro.com/support/recip … edirection .
Thanks!
- Index
- » MetaMod
- » MetaMod General Support
- » Can metamod work with CB subs?
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7624
- Newest User:
- borger3298
- Members Online:
- 0
- Guests Online:
- 118
- 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