Featured Places showing in my Favorites?

This topic contains 20 replies, has 3 voices, and was last updated by  jack3 9 years, 9 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #10687

    jack3
    Buyer
    Post count: 67

    OK So I created a new template page called “Where You’ve Been” and put in some code:

    
    
    <?php /*  
    Template Name: Favorite Redirect
    */ 
    // get header
    get_header(); 
    
    if (is_user_logged_in()){
    
    global $current_user;
          get_currentuserinfo();
    $user_ID = get_current_user_id();
    $user_info = get_userdata($user_ID);
    
    function curPageURL() {
     $pageURL = 'http';
     if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     $pageURL .= "://";
     if ($_SERVER["SERVER_PORT"] != "80") {
      $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     } else {
      $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }
     return $pageURL;
    }
    
    $favorite_url = 'http://www.eatlocalnky.com/author/'. $user_info->user_nicename .'/?geodir_dashbord=true&stype=gd_place&list=favourite';
    
    if(curPageURL()!=$favorite_url){
    ?>
    <script>
    window.location = "<?php echo$favorite_url;?>";
    </script>
    <?php
    }
    }
    else {
    ###### WRAPPER OPEN ######
    // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='')
    do_action( 'geodir_wrapper_open', 'signup-page', 'geodir-wrapper','');
    	
    	###### TOP CONTENT ######
    	// action called before the main content and the page specific content
    	do_action('geodir_top_content', 'signup-page');
    	// template specific, this can add the sidebar top section and breadcrums
    	do_action('geodir_signin_before_main_content');
    	// action called before the main content
    	do_action('geodir_before_main_content', 'signup-page');
    
    			###### MAIN CONTENT WRAPPERS OPEN ######
    			// this adds the opening html tags to the content div, this required the closing tag below :: ($type='',$id='',$class='')
    			do_action( 'geodir_wrapper_content_open', 'signup-page', 'geodir-wrapper-content','geodir-content-fullwidth');
    			
    			// this action adds the top sidebar
    			do_action( 'geodir_sidebar_signup_top');
    ?>
    <h4>You must be logged into the site to view this page. Please login or sign-up below. </h4>
    				<form name="loginform" class="loginform1" action="<?php echo get_option('home').'/index.php?geodir_signup=true'; ?>" method="post" >
    					<div class="geodir_form_row"><input placeholder="<?php _e('Email', GEODIRECTORY_TEXTDOMAIN);?>" name="log" type="text" class="textfield user_login1" /> <span class="user_loginInfo"></span> </div>
    					<div class="geodir_form_row"><input placeholder="<?php _e('Password', GEODIRECTORY_TEXTDOMAIN);?>" name="pwd" type="password" class="textfield user_pass1" /><span class="user_passInfo"></span>  </div>
    					
    					<input type="hidden" name="redirect_to" value="<?php echo geodir_curPageURL(); ?>" />
    					<input type="hidden" name="testcookie" value="1" />
    					<div class="geodir_form_row clearfix"><input type="submit" name="submit" value="<?php echo SIGN_IN_BUTTON;?>" class="b_signin"/><p class="geodir-new-forgot-link">   
                        <a href="<?php echo home_url(); ?>/?geodir_signup=true&page1=sign_up" class="goedir-newuser-link"><?php echo NEW_USER_TEXT;?></a>  
                        <br>
                        <a href="<?php echo home_url(); ?>/?geodir_signup=true&page1=sign_in"class="goedir-newuser-link"><?php echo FORGOT_PW_TEXT;?></a> </p> </div>
    				 </form> 
    <?php				 
    			###### MAIN CONTENT WRAPPERS CLOSE ######
    			// this adds the closing html tags to the wrapper_content div :: ($type='')
    			do_action( 'geodir_wrapper_content_close', 'signup-page');
    			   
    ###### WRAPPER CLOSE ######	
    // this adds the closing html tags to the wrapper div :: ($type='')
    do_action( 'geodir_wrapper_close', 'signup-page');
    get_footer();  
    };
    

    I know it isn’t full proof. But it creates the user’s URL for a favorites page and sends the user to that page. If they are not logged in it only shows the User Login page.

    I wanted it to show the full page with registration – but that didn’t work for some reason. Whenever I put in the username and password it would clear the selection but take them anywhere. If you have an idea on how to fix that – awesome. If not this will suffice for now.

    Thanks!

    Jack

    #10718

    Guust
    Moderator
    Post count: 29970

    As it currently is the logged in link goes to the “author” page: a landing page for the individual that has links to all their favorites, links to edit any listings they might have submitted and links to add a listing. At this time you cannot show the user’s reviews there.
    That is if you set it up that way at
    /wp-admin/admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_navigation_settings

    Your other question is about having a link in your main menu that says “Your Favorites” and goes to the particular user’s favorites page.

    I think that would pose quite a few problems for a number of reasons:

    1. The link should be a dynamic link that knows who is logged in [not a problem]
    2. But how can that work if you are not logged in [not possible I think]
    3. You could solve that with having a link to Favorites that only shows if you are already logged in [but that is not different from what I suggested earlier]
    4. There is no page that shows all your Favorites, unless you only have one CPT [which you do for the moment – but maybe not later]
    5. Might be difficult to add to the menu

    So just in your case [because you use GDF and have only one CPT] you could maybe change the function in
    wp-content/themes/GeoDirectory_framework/library/geodirectory_framework.php
    and that would change the link in the GDF welcome widget to the favorites page instead of the general landing page for the user.

    #10719

    Guust
    Moderator
    Post count: 29970

    Right, posts crossed.
    Don’t directly see the difference between what you’ve done and what the GDF welcome widget does if you link it to the favorite section of the author page …

    #10863

    jack3
    Buyer
    Post count: 67

    Thanks Guust – it appears that when I click login – it takes me to the home page. The difference that I’ve done is that I don’t need to use the widget anymore. I didn’t like having it there because I didn’t want the users to have the other options. Even though you can turn them all off – I didn’t like the way the interface looked at that point with just one dropdown for one CPT.

    #10866

    Guust
    Moderator
    Post count: 29970

    I see. All resolved then?

    #10867

    jack3
    Buyer
    Post count: 67

    Yes sir – thanks for the help!

Viewing 6 posts - 16 through 21 (of 21 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket