PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

finding the redirect to code in my theme

s2Member Plugin. A Membership plugin for WordPress®.

finding the redirect to code in my theme

Postby dwaynecla » December 21st, 2011, 6:57 pm

I watched the tutorial video about how to get the log in page to work when it does not redirect to the welcome page. The video was easy to understand but I can't find the "redirect to" code within my theme. I viewed the source file of my log in page and I see the hidden field but I can't find it within my theme.

I'm using optimized press and when I go to edit my theme I have about a hundred different templates to choose from. I'm gone through about them and I can't find that line of code.

If anyone knows where it's hiding within optimize press I would appreciate it...

thanks
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 21st, 2011, 7:31 pm

Don't know if this helps
If you go to
s2member > general options > login welcome page
and choose the page from the drop down menu that you want users to be redirected to?
Also I think if you login as admin you won't go to that page
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 3:10 am

thanks for your reply...but that does not help. What you suggested I already did... this is an issue with the actual code in the page. Wordpress puts a "hidden" field on your log in form page. The only way to move it is to delete the code...S2 member had a video that shows you how to do this and it's easy...but I can't find the line of code within my template
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 4:58 am

Have you got a file in your theme called members-style1-login in there is a line

<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />

perhaps that is what your looking for?
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 6:32 am

i found that....and deleted that line...but the problem is still there... In the tutorial video... it says that I will see the actual address where it's being redirected to and I need to delete that... this is the tutorial http://www.s2member.com/login-welcome-p ... -video/....

I'm continuing to search my templates codes... but no luck yet
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 6:39 am

what happens if you leave the line there but change

<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />

to

<input type="hidden" name="redirect_to" value="http://www.yoursite.com/yourwelcomepage/" />
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 6:53 am

that didn't work either...
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 7:03 am

Is it because the page was created with the old template with the redirect intact?
or is there something in your functions file that is handling the redirect?

adding something like this to your functions file might work (different redirect if you use admin) but wont help in finding the cause

function my_login_redirect($redirect_to, $request, $user)
{
//is there a user to check?
if(is_array($user->roles))
{
//check for admins
if(in_array("administrator", $user->roles))
return home_url("/wp-admin/");
else
return home_url(/yourwelcomepage/);
}
}
add_filter("login_redirect", "my_login_redirect", 10, 3);
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 7:25 am

I have no idea how or where to add this code you presented above....and is it all of it? or just some???? not sure how to proceed.

But I will delete the log in and welcome pages and re-create and publish to see if that helps because as you stated the page was created with the redirect intack...
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 7:33 am

Hopefully that will work if not I can explain where to add that code
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 7:36 am

deleted the old page and then created it again...that didn't work.....
the following is what I see under theme functions...sorry to paste the entire code...what do I add to it and where??

<?php
// Instantiate the class
require_once(TEMPLATEPATH . '/admin/clshelpfields.php');
require_once(TEMPLATEPATH . '/admin/clscustomfields.php');
require_once(TEMPLATEPATH . '/admin/clsblogfields.php');
require_once(TEMPLATEPATH . '/admin/clsmemcustomfields.php');
require_once(TEMPLATEPATH . '/admin/clslpcustomfields.php');
require_once(TEMPLATEPATH . '/admin/clsseocustomfields.php');
if ( class_exists('myHelpFields') ) {
$myHelpFields_var = new myHelpFields();
}

if ( class_exists('myCustomFields') ) {
$myCustomFields_var = new myCustomFields();
}

if ( class_exists('myBlogFields') ) {
$myBlogFields_var = new myBlogFields();
}

if ( class_exists('myLpCustomFields') ) {
$myLpCustomFields_var = new myLpCustomFields();
}

if ( class_exists('myMemCustomFields') ) {
$myMemCustomFields_var = new myMemCustomFields();
}

// Instantiate the class
if ( class_exists('mySeoCustomFields') ) {
$mySeoCustomFields_var = new mySeoCustomFields();
}


/* Admin Sidebar Panel */
// integrates duplicate post plugin w/o installing it
require_once(TEMPLATEPATH . '/admin/duplicate-post.php');
/**
* Defines the necessary constants and includes the necessary files.
*/

// Define Directory Constants
define('OPTPRESS_LIB', TEMPLATEPATH . '/lib');
define('OPTPRESS_ADMIN', OPTPRESS_LIB . '/admin');
define('OPTPRESS_CLASSES', OPTPRESS_LIB . '/classes');
define('OPTPRESS_FUNCTIONS', OPTPRESS_LIB . '/functions');
define('OPTPRESS_INCLUDES', OPTPRESS_LIB . '/includes');
define('OPTPRESS_ADMIN_CSS', get_template_directory_uri() . '/lib/admin/css' );
define('OPTPRESS_ADMIN_JS', get_template_directory_uri() . '/lib/admin/js' );
define('OPTPRESS_JS', get_template_directory_uri() . '/lib/scripts' );
require_once(OPTPRESS_LIB . '/classes/Seo.php');

// Define Folder Constants
define('OPTPRESS_SCRIPTS_FOLDER', get_bloginfo('template_url') . '/lib/scripts');

// Load Theme Options
require_once(OPTPRESS_ADMIN . '/admin-options.php');

// Load Admin Interface
require_once(OPTPRESS_ADMIN . '/admin-interface.php');

// Load Admin Scripts and Css
require_once(OPTPRESS_ADMIN . '/admin-scripts.php');

// Load TinyMCE Plugin
require_once(OPTPRESS_ADMIN . '/tinymce/tinymce.php');

// Load wp-pagenavi
require_once(OPTPRESS_INCLUDES . '/wp-pagenavi.php');

// Load Options from the Database
require_once(OPTPRESS_INCLUDES . "/var.php");

// Load Theme Functions
require_once(OPTPRESS_FUNCTIONS . '/theme-functions.php');

// Load Custom Shortcodes
require_once(OPTPRESS_FUNCTIONS . '/shortcode.php');

// Redirect To Theme Options Page on Activation
if ($_GET['activated']){
wp_redirect(admin_url("admin.php?page=$page_handle&upgraded=true"));
}

function time_ago( $type = 'comment' ) {
$d = 'comment' == $type ? 'get_comment_time' : 'get_post_time';
return human_time_diff($d('U'), current_time('timestamp')) . " " . __('ago');
}

// force a line break in wordpress
$init = array();
function nice_mce_options($init) {
$init['remove_linebreaks'] = false;
$init['apply_source_formatting'] = true;
return $init;
}
apply_filters( 'tiny_mce_before_init', 'nice_mce_options' );
apply_filters( 'teeny_mce_before_init', 'nice_mce_options' );


function getImages($dir)
{
global $imagetypes;

# array to hold return value
$retval = array();

# add trailing slash if missing
if(substr($dir, -1) != "/") $dir .= "/";

# full server path to directory
$fulldir = "{$_SERVER['DOCUMENT_ROOT']}/$dir";

$d = @dir($fulldir) or die("getImages: Failed opening directory $dir for reading");
while(false !== ($entry = $d->read())) {
# skip hidden files
if($entry[0] == ".") continue;

# check for image files
if(in_array(mime_content_type("$fulldir$entry"), $imagetypes)) {
$retval[] = array(
"file" => "/$dir$entry",
"size" => getimagesize("$fulldir$entry")
);
}
}
$d->close();

return $retval;
}

// membership page options
function my_custom_login_page() {
require(OPTPRESS_INCLUDES . "/var.php");
echo '<style type="text/css">
html{background:#'.$membershippagebgcolor.';}
body{background:#'.$membershippagebgcolor.';}
h1 a { background-image:url('.$membershippagelogourl.') !important;height:123px; }
</style>';
}

add_action('login_head', 'my_custom_login_page');

// Setup Navigation Bar For Members area

//dd_action('init', 'register_custom_menus');

//function register_custom_menu() {
//register_nav_menu('custom_menu', __('Membership Menu'));
//}

add_action( 'init', 'register_my_menus' );

function register_my_menus() {
if ( function_exists( 'register_nav_menus' ) ) {
register_nav_menus(
array(
'custom_menu' => __( 'Membership Menu' ),
'blog_menu' => __( 'Blog Menus' ),
'sales_menu' => __( 'Sales Menu' ),
'squeeze_menu' => __( 'Squeeze Page Menu' )
)
);
}
}



// Function that output's the contents of the dashboard widget
function optimizepress_widget_function() {
echo '<div class="rss-widget">';
wp_widget_rss_output( 'http://www.facebook.com/feeds/page.php?format=atom10&id=158684170823047', array('items' => 4, 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1) );
echo "</div>";
}

// Function that beeng used in the action hook
function add_optimizepress_widgets() {
wp_add_dashboard_widget('optimizepress_widget', 'OptimizePress Updates', 'optimizepress_widget_function');
}

// Register the new optimizepress widget into the 'wp_dashboard_setup' action
add_action('wp_dashboard_setup', 'add_optimizepress_widgets' );

// Pagination
function i_pagination($pages = '', $range = 2)
{
$showitems = ($range * 2)+1;

global $paged;
if(empty($paged)) $paged = 1;

if($pages == '')
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}

if(1 != $pages)
{
echo "<div class='pagination'>";
if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo;</a>";
if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</a>";

for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>";
}
}

if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>&rsaquo;</a>";
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>&raquo;</a>";
echo "</div>\n";
}
}

function optimizepress_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li id="comment-<?php comment_ID(); ?>">


<div class="launchcommentspic"><?php
echo get_avatar( $comment, 75 );
?><br>
<span style="color:#636363;"><?php comment_author_link(); ?></span><br>
<?php
$postcustom = get_post_custom($post->ID); ?>
<?php echo ($postcustom['_launchpage_disabledatewpcomments']) ? '' : time_ago(); ?>
</div>

<div style="float:left;" class="commentswidth">
<?php if ($comment->comment_approved == '0') : ?>
<p>Your comment is awaiting approval</p>
<?php endif; ?>
<?php comment_text(); ?>


</div>
<div style="clear:both;"></div>

<?php
}

function optimizepressautop($pee, $br = 1) {

if ( trim($pee) === '' )
return '';
$pee = $pee . "\n"; // just to make things a little easier, pad the end
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
// Space things out a little
$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
$pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
$pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
if ( strpos($pee, '<object') !== false ) {
$pee = preg_replace('|\s*<param([^>]*)>\s*|', "<param$1>", $pee); // no pee inside object/embed
$pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee);
}
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
// make paragraphs, including one at the end
$pees = preg_split('/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY);
$pee = '';
foreach ( $pees as $tinkle )
$pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
$pee = preg_replace('|<p>\s*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
$pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);
$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
if ($br) {
$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "<WPPreserveNewline />", $matches[0]);'), $pee);
$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
$pee = str_replace('<WPPreserveNewline />', "\n", $pee);
}
$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
if (strpos($pee, '<pre') !== false)
$pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
$pee = preg_replace( "|\n</p>$|", '</p>', $pee );

return $pee;
}

function field_func($atts) {
global $post;
$name = $atts['name'];
if (empty($name)) return;

return get_post_meta($post->ID, $name, true);
}

add_shortcode('field', 'field_func');

// Load Old Custom Shortcodes
require_once(OPTPRESS_FUNCTIONS . '/shortcode_old.php');


add_filter('widget_text', 'do_shortcode');

// Load JQuery Files From Google

if( !is_admin()){
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"), false, '1.3.2');
wp_enqueue_script('jquery');
}

function excerpt($num)
{
$limit = $num+1;
$excerpt = explode(' ', get_the_excerpt().' ', $limit);
array_pop($excerpt);
$excerpt = implode(" ",$excerpt)."…";
echo $excerpt;
}

?>
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 7:54 am

ok let me test this first I don't want to break your installation
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 8:07 am

okay
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 8:38 am

something is even overriding that function, so that wont work.

under
s2member > general options > member profile modifications

Have you selected "yes(redirect............)"

that should then redirect to the page you selected under
s2member > general options > login welcome page
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 8:51 am

yes this was selected ...problem still exists.
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 8:54 am

are you logging in with your admin account?
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 8:59 am

yes I do log in as admin... if I log in as admin I see my admin area....it's all the other log in levels that don't work ...
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 9:11 am

so when you log in as a subscriber where are you being directed too?
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 9:21 am

not being redirected...it just reloads the log in screen...see for yourself here:
http://jelanikhalfani.com
user: membertest
Pw: winner60
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 9:56 am

strange

have you tried disabling your plugins and then seeing if it works?

Also what template did you use to create /log-in-welcome-page/ under page attributes?
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 10:05 am

if i disable the plugin then s2 member won't be loaded any more...right???
wouldn't that defeat the purpose of trying to get s2 member to work...?...
and the page template is the default template..for the log in welcome page
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 10:07 am

I mean plugins other than s2member they could be causing a conflict?
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 10:13 am

done...didn't work
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Re: finding the redirect to code in my theme

Postby Philly » December 22nd, 2011, 10:34 am

ok I can see that everything is configured correctly,

You have a problem were your server is redirecting all urls to wp-login.php

Do you have access to your .htaccess file?
User avatar
Philly
Experienced User
Experienced User
 
Posts: 48
Joined: December 19, 2011

Re: finding the redirect to code in my theme

Postby dwaynecla » December 22nd, 2011, 10:40 am

where do I find it...would that be in my hostgator hosting account??
User avatar
dwaynecla
Registered User
Registered User
 
Posts: 17
Joined: December 21, 2011

Next

Return to s2Member Plugin

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest

cron