Updating CB 1.9.1 to 4.0.12 and CBSubs 3.0.0 to 4.1.0

7 years 10 months ago #283688 by poml
Thanks for the suggestion. I can see where you are aiming at. Unfortunately the subscriptions tab does not work for me in this case. I have some exclusive plans that do not allow the merchandise plans to be displayed.

There must be a way. It was so nice in CBSubs 3.0.0. The ACLs are set in the plans and they were taken into account.

Right now I am lacking an idea how to work around this. Can you help me out? I was digging around in the CBSubs code, but I made no progress.
The topic has been locked.
7 years 10 months ago - 7 years 10 months ago #283690 by poml
If I change line 32 in cbpaidControllerUI.php to
$plans					=	$plansMgr->loadPublishedPlans( $user, true, 'registration', null );

it takes into account the user. The functionality is all there... Maybe a second variable could be added, like $plansacl or so?

Or I can add a new function in that file like below, but is this a good solution?
public function getShowRegistrationPlansACL( $user, $plansTitle, $reason, $noPlan = false ) {
		$plansMgr				=	cbpaidPlansMgr::getInstance();
		$plans					=	$plansMgr->loadPublishedPlans( $user, true, 'registration', null );
		$allPlans				=	$plansMgr->loadPublishedPlans( $user, true, null, null );

		$specificChoice			=	$this->_unsetIrrelevantPlans( $plans );
		$this->_unsetNotProposedRegistrationPlans( $plans );
		if ( $specificChoice ) {
			$chosenPlans		=	$this->_chooseMaxPlans( $plans );
		} else {
			$chosenPlans		=	$this->_planGetAndCheckReqParamArray( $user, 'plan', $plans, true, $reason );
		}
		if ( ! is_array( $chosenPlans ) ) {
			$chosenPlans		=	array();		// no need to display errors here.
		}
		$return					=	$this->_getFormattedPlans( $user, $plans, $plansTitle, $chosenPlans, $reason, $noPlan );

		// finally generate JS code if needed, taking in account hidden fields of all plans:
		$this->_addJsCodeIfNeeded( $allPlans, $reason );

		return $return;
	}
The topic has been locked.
7 years 10 months ago - 7 years 10 months ago #283691 by poml
Remember my problem with the payment options page in a previous post?
www.joomlapolis.com/forum/255-developer-members-support/234051-updating-cb-1-9-1-to-4-0-12-and-cbsubs-3-0-0-to-4-1-0?start=24#283516

I thought about your suggestions and the menu items. It seems that everything works fine if I use the Joomla menu items, but my own code does not work.

So maybe the url has changed somewhere and I am not using the proper one?

In my code I use the following url and a form to submit the basket (of a new user):
$url = JUri::root().'index.php?option=com_comprofiler&task=pluginclass&plugin=cbpaidsubscriptions&user='.$UserId;

form action="'.$url.'" method="post" id="Paymentform"

$html .= '				input type="submit" value="Show the payment options" /

If I use this, then I see the payment options, but when I click on one of the options I get redirected to the registration page.

For an existing user I use this and the same form
$url = JUri::root().'index.php?option=com_comprofiler&task=pluginclass&plugin=cbpaidsubscriptions&user='.$UserId;

But then I get an error message:
"Session expired or cookies are not enabled in your browser. Please press "reload page" in your browser, and enable cookies in your browser. Please refresh/reload page before filling-in."

Under CBSubs 3.0.0 everything was working fine, maybe I am using the wrong URLs in CBSubs 4.1.0?

The latter one, does it have to do with usage of cbGetSpoofInputTag? Did something change here?

Hm... My code still seems to work.
$spoof = cbGetSpoofInputTag( 'cbpaid' );
			preg_match('/input type="hidden" name="(.*?)" value="(.*?)" \//ism', $spoof, $spoofmatch);
			$data[$spoofmatch[1]] = $spoofmatch[2];

Is there something new? A new security feature that I have to take into account?

EDIT: Ah, it seems that the secret is "plugin" now?
$spoof = cbGetSpoofInputTag( 'plugin' );

EDIT2: So, with this I could test the code for an existing user, and my form works fine with the URL.
$url = JUri::root().'index.php?option=com_comprofiler&task=pluginclass&plugin=cbpaidsubscriptions&user='.$UserId;

Now I need to understand why I get redirected whem I am a new user?

EDIT3: It seems that also the "new user" works with this url:
$url = 	JUri::root().'cb-profile/saveregisters';
The topic has been locked.
7 years 10 months ago #283697 by krileon
The API previously provided is the correct API for outputting the plans. Please note registration view of plans ignores the access checks during registration. If you don't want a plan shown to a public user during registration then set the plan to not show on registration.

So maybe the url has changed somewhere and I am not using the proper one?

Your URL API usages are not correct. You specially should never hardcode relative URLs (SEFed). Below is the API for outputting a view URL in CB.

$profileUrl = $_CB_framework->userProfileUrl( USER_ID );
$viewUrl = $_CB_framework->viewUrl( VIEW );

CBSubs Plans Display URL is as follows.

index.php?option=com_comprofiler&task=pluginclass&plugin=cbpaidsubscriptions&do=displayplans

With API this is as follows for plugin view URLs.

$displayPlans = $_CB_framework->pluginClassUrl( 'cbpaidsubscriptions', true, array( 'do' => 'displayplans' ) );

CB API needs to be loaded and the $_CB_framework global declared for the above to work. Review existing plugins for further usage examples (they're all using this API).

I've no idea what you're trying to do with the spoof string.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The topic has been locked.
7 years 10 months ago #283720 by poml
I think the suggestion with the subscription tab will not work for me because of the exclusive plans. So far the only solution I found is to add another function to cbpaidControllerUI.php .

I will try to understand your suggestions from your last post.

I've no idea what you're trying to do with the spoof string.

Well, it gives me the cbsecuritym3 value, otherwise I cannot proceed as a logged in user.
The topic has been locked.
7 years 10 months ago #283743 by krileon

I think the suggestion with the subscription tab will not work for me because of the exclusive plans. So far the only solution I found is to add another function to cbpaidControllerUI.php .

Do not modify core files. We do not provide support for installs with core modifications. Don't understand how this affects exclusive plans. If you've a plan set to Registered access under the Access tab for example it's ignored for registration as the display on registration parameter has priority. To prevent this you simply set the plan to not display on registration under the Workflows tab. This solves the issue of plans displaying during registration that you don't want displaying. The API usage you're wanting doesn't make sense to the configuration.

Well, it gives me the cbsecuritym3 value, otherwise I cannot proceed as a logged in user.

We have several spoof string functions. 1 outputs the completed input. Another gives you the spoof input name and another gives you its value.

cbGetSpoofInputTag() = Input
cbSpoofField() = Name
cbSpoofString( null, $secret ) = Value

Secret in most cases is "plugin".


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The topic has been locked.
Moderators: beatnantkrileon
Time to create page: 0.443 seconds

Facebook Twitter LinkedIn