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