JomSocial - Registration Redirection - joomla2.5

I am working on jomsocial. I have installed the "Redirect Registration for JomSocial" plugin for redirecting the registration page to jomsocial registration. I am getting the registration page but once the first step in registration in completed the page redirects to login page showing the message as "Please Login first".
This is happens only if I disables the menu "Jomsocial" that is created during jomsocial installation.
Is there any other way to redirect the registration page to jomsocial registration.

It seems that you have menu item issue. probably you create some menu items outside JomSocial toolbar and you've set for one of this menu item (the one with highest menu item ID) privacy restriction.
So You get to registration page and when clicking next Joomla! is taking menu item ID from menu item I mentioned above... this cause redirection to "Please, login first". Just check your menu items ;)

You may not disable the jomsocial menu items, if you don't want to show them just put them in a new menu, which you won't create a module for (or create a module and don't assign it to any position). This is why it's failing now. The function requiring this is getMenuItem() in the redirect plugin.
What you will find next is that a visitor clicking on a link that requires login will be sent to the login page with a &return parameter with the encoded url it's supposed to go back to after login. This is not handled by jomsocial plugin, just change is like this:
file plugins/system/jomsocialredirect/jomsocialredirect.php
/**
* Method to override Login / Logout redirect
*/
private function overrideRedirectLoginLogout() {
$mainframe =& JFactory::getApplication();
$task = JRequest::getVar ( 'task' );
switch ($task) {
case 'user.login' : //Joomla 1.6 and later
case 'login' : /* on logging */
/**
* krz This next line restores working status of login redirects.
* (the purpose of jomsocialredirect plugin is to redirect after login, but some links for guests
* point to com_login with a return url set; if this is the case, the next line makes the feature work,
* otherwise it would be overridden;
* note: redirect is to be avoided on logout.
*/
if (JRequest::getVar('return','')!='') return;
if ($this->login ()) { /* we do login by self */
/* redirect if login success */
$link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_login', 1 ) );
$mainframe->redirect ( $link, JText::_ ( $this->pluginParams->get ( 'redirect_login_msg', 'LOGIN_SUCCESSFUL' ) ), 'message' );
} else {
/* redirect if login failed */
$link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_login_failed', 1 ) );
$mainframe->redirect ( $link, JText::_ ( $this->pluginParams->get ( 'redirect_login_failed_msg', 'LOGIN_FAILED' ) ), 'notice' );
}
break;
case 'user.logout' : //Joomla 1.6 and later
case 'logout' :
$link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_logout', 1 ) );
JFactory::getApplication ()->logout ();
$mainframe->redirect ( $link, JText::_ ( $this->pluginParams->get ( 'redirect_logout_msg', 'YOU_HAVE_LOGGED_OUT' ) ), 'message' );
break;
default :
/* override redirect after login / logout */
$view = JRequest::getVar('view','');
if ($view=='profile') {
$link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_login', 1 ) );
$mainframe->redirect ( $link);
}
break;
}
}

Related

contact forms 7 how to add cookie and ip 24 hours on submission button

i want to make user use submit button every 24 hours
function dd_handle_form_submission( $contact_form ) { // Check Form ID if( 2744 !== $contact_form->id() ) return; // Use your form ID here $submission = WPCF7_Submission::get_instance();

How to save the parent model from children?

I have a parent route. it has the model which is used by all child routes. when i consume the parent model from one of child ( first page ) I am updating the model like this:
selectedList : Ember.computed.map('model.selectedTrans', function(card,index){
return Ember.Object.create({
count : index + 1, //adding new info
countSize : this.get('model.selectedTrans').length,
durations:[6,12],
duration:12 //adding new info
})
}),
after this, I am taking the user to next page ( sibling of updated page ), but when i try to fetch the updated info, I am not able to get it. the updated info not at all available there is next page.
what is the issue here? or how to update the local model? ( I am not sending or fetching from server )

Accept a Popup using Phantomjs with Selenium

I am using python 2.7, Selenium, and PhantomJs.
When I click the sign in button in my script it goes to a new page and a popup appears that I must accept.
Here is the code I am trying to use. I got it from here
How can I handle an alert with GhostDriver via Python?
sign_in.click()
js = 'window.alert = function(message) { lastAlert = message; }'
driver.execute_script("%s" % js)
driver.execute_script("return lastAlert")
Here is the error that I get:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message:
{"errorMessage":"Can't find variable: lastAlert","request":{"hea
ders":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"95","Content-Type
":"application/json;charset=UTF-8","Host":"127.0.0.1:56712","User-Agent":"Python-urllib/2.7"},"httpVersion":"1.1","metho
d":"POST","post":"{\"sessionId\":
\"3832e2c0-4902-11e6-b766-0d7f487d0794\", \"args\": [], \"script\":
\"return lastAlert
\"}","url":"/execute","urlParsed":{"anchor":"","query":"","file":"execute","directory":"/","path":"/execute","relative":
"/execute","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/execute","q
ueryKey":{},"chunks":["execute"]},"urlOriginal":"/session/3832e2c0-4902-11e6-b766-0d7f487d0794/execute"}}
Screenshot: available via screen
I am not very experienced with javascript and a point in the right direction would be useful.
Here is the Behat step that I'm using:
/**
* This step overrides windows.confirm and basically accepts it before it is displayed.
*
* #When /^(?:|I )bypass the popup$/
*/
public function bypassPopup() {
$function = "
var realConfirm=window.confirm;
window.confirm=function(){
window.confirm=realConfirm;
return true;
};
";
$session = $this->getSession();
$session->executeScript($function);
}
You place it before you click on the button and when you click your popup will be accepted automatically.
In this case, only the first popup will be accepted.

HTML Redirect After Load

I’m displaying dropdowns in HTML to alter a SAS output. The values of the dropdowns only affect SAS each time the page loads. I want to link to a second page and pass the values of the dropdown. However SAS is unaware of what the values are unless the current page reloads and saves the dropdown values. So I want to reload the same page when the user clicks a button. Then redirect the user to a second page. All of the redirect code I see redirects the user 100% of the time while I only want to redirect the based on a condition.
The method I described in my comment would look something like this.
HTML:
<button onclick="saveData()">Save</button>
JS:
(function() {
if ( getQueryVariable("data") == "saved" ) {
alert("true");
}
})();
function saveData() {
var newPage = window.location.href + "?data=saved";
window.location.replace(newPage);
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
I added this to the dropdownlists
onchange='this.form.submit()'
Which made the refresh button not needed.

Woocommerce Tabs Conditional

I running the Woocommerce plugin ( Version 2.013) with Woocommerce Tab Manager extension (Version 1.08). Also Canvas Child Theme (Version 0.1.0)
I'm trying only show certain tabs for certain products using a conditional statement.
The tab manager doesn't allow conditional statements for each tab. It only allows default global tabs or product specific tabs assigned in the product edit page.
I found a decent way to show tabs in the product page based on the a product attribute.
First I thought I share this code because it seems to work. But I'm still wondering if there is a better way to do this?
What I would really like is to create a tab in the Tab Manager and apply the conditional statement to it.
// Video Tabs for Product Page - Activate New Video Tab if Attribute matches
add_filter( 'woocommerce_product_tabs', 'video_tab' );
function video_tab( $tabs ) {
$type = array_shift(woocommerce_get_product_terms($_product->id, 'pa_type', 'names'));
if ( $type == "TypeA" ) {
$video_tab = array( 'video_tab' => array( 'title' => $type.' Video', 'priority' => 9, 'callback' => 'video_tab_func' ) );
return array_merge( $video_tab, $tabs );
}
else {
return $tabs;
}
}
// Tab Desctribtion
function video_tab_func() {
$type = array_shift(woocommerce_get_product_terms($_product->id, 'pa_type', 'names'));
if ( $type == "TypeA" ) {
echo do_shortcode( '[video src="/wp-content/uploads/2013/08/TypeA-video.mp4"]' );
}
}