• Resolved arr0w

    (@arr0w)


    Hello

    I’m using the Login-addon you have created to let users log in on my site and I want users to be able to favorite posts. The favorited posts should then be saved to their private page and listed as clickable names.
    Do you know a way to do this?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author xnau webdesign

    (@xnau)

    It’s important to understand that my “login” add-on doesn’t log people in to WordPress, it just gives them access to their Participants Database record. This means there is no way to know who they are on other pages, so there is no way for them to “favorite” posts. They have to be logged in as a WordPress user to do that kind of thing.

    Thread Starter arr0w

    (@arr0w)

    I know that, but I actually manage to find a solution with jQuery.
    It may not be the best solution, but it works!
    I’ve created a new PDB textfield which I place on the pages which is possible to favorite. Then I hide the field and rename the button to “Favorite”.

    When a user with the pdb_persistence cookie enters the site the script does the following:

    
    var favorite = $("#pdb-favorites").val();
    var fullpath = window.location.href
    var posttitle = $("h1.post-title").html()
    if ($("#pdb-favorites").val().indexOf(fullpath) > -1) {
    		$("button.btn.btn-default").prop("disabled", true).html("Added!");
    	}
    	else { 
    		$("#pdb-favorites").val(favorite+'<li><a href="'+fullpath+'">'+posttitle+'</a></li>')
    	}
    }

    If the user hit “Favorite” the data is saved
    On the users private page I just append the text into a

    Viewing 2 replies - 1 through 2 (of 2 total)
    • The topic ‘Favorite posts when logged in’ is closed to new replies.