On a golf site I’m setting up, I’m allowing members to save courses as favorites. I already had the courses in the database before implementing the favorites module. After the putting the favorites module in place, everything worked like a charm.
Here is the code I’m using on the favorites page:
{if logged_in} <h1>{if screen_name != ""}{screen_name}'s{if:else}{username}'s{/if} Favorite Courses</h1> {exp:favorites:entries weblog="courses"} {if no_results} <p>You haven't saved any courses as favorites. To save a course as a favorite, visit the <a href="/courses" title="Courses">courses</a> section (or search for a course in in the sidebar to your right), search for your favorite courses, and save them as favorites on the course details page.</p> {/if}
{if count == 1} <p class="small">{exp:user:is_mine member_id="{segment_3}"}{if mine}<em>Note: To remove a course from your favorites, click on the name and then click "remove from favorites."</em>{/if}{/exp:user:is_mine}</p> {/if} {/exp:favorites:entries} {/if}
Yesterday, I had to add another course into the database. I noticed today that after adding the course to the database, it shows up at the top of the favorites page even when it’s not saved as a favorite. I’ve noticed that it shows up and stays there regardless of if it’s been saved or not only when I’m logged in (as Admin). If I log in under the test account I’ve created, the new course doesn’t show up at the top of the favorites list regardless of if it’s been saved or not… it does just the opposite, it NEVER shows up even when you save it as a favorite. Another thing that seems funny is that on the new course page itself, even when it’s not been saved or when it’s been saved more than once, the text output always reads “saved as a favorite 1 time” and doesn’t change.
What would be the first course of action here to figuring this problem out? I’m running Favorites 2.1.4. Should I just delete the new entry and try to recreate it and see what happens?
This is one of the silliest settings Favorites has…
What’s happening is the Favorites Module is set to automatically add weblog entries to the Author when created.
<sarcasm>“Yes…. thanks Favorites”</sarcasm> haha
It did fix the initial problem, but unfortunately is presented another problem.
Now, the new entry does not show up in the favorites list at all now that I’ve changed that setting to “NO”. Even when I go into the entry and save it as a favorite, nothing happens. This is the only entry it’s happening on as I’ve tested numerous other entries and can save and delete them from favorites with no problems at all. The new entry in question always says “not saved as a favorite yet” even when it is saved as a favorite and it never shows up in the favorites list.
The entry in question is: http://www.kentuckygolfing.com/courses/details/olde-stone/
You can login as my test account by using: username: test and password: testing.
By using the course search, you can search for zip code: 40511 and any other course you add as a favorite works fine. (Favorites link is in the top member control area under the search).
All of the entries that seem to work were created before the favorites module was even put into play and this one entry that isn’t working is the only one that wasn’t created beforehand, so I’m not sure if that has anything to do with it or not, but seems possible.
BTW: I went ahead and updated my version of the Favorites module as well as deleted and recreated this particular entry to try and fix this.
Hey! Well, when I changed the “add new entries automatically” to “NO” in the extension settings, that actually changed how everything was working. Now, no matter what I do, I cannot get the new entry to show up on the Favorites page… so using the delete button won’t work in this situation since it doesn’t show up.
Or am I misunderstanding what you’re talking about?
The entry you showed me allowed me to add and remove the entry, but I don’t think it “completely” was doing it, as the message under the link (even after a refresh) still said the entry wasn’t added, but the Add-to/Remove link seemed to “understand” and remember it was added.
So I’m wondering if you add/remove it as Entry ID instead of URL_Title a few times, linking like:
Yeah, after I change the add/delete links to use {entry_id} instead of {url_title} it seems to work without problem. Do you think there is a fix to make it work with {url_title} or should I just forget about it and use {entry_id}? It would just require me going through the templates and changing all instances of {url_title} to {entry_id} for the courses, which isn’t a big deal, but I feel like using {url_title} is a little more user friendly than having a number show up in the URL.
Thoughts? Just doesn’t make much sense to me that it’s fine for every entry except new ones.
PS: Yeah, the message under the link telling how many times it’s been saved as a favorite doesn’t update until refresh. I’m not good enough with jQuery to know how to make it update on the fly.
My intent of you doing this with the Entry ID was only to “fix” the problem. I’m wondering if adding and removing it this way (with the Entry ID) would “fix” the problem with adding it as URL Title. After removing it with Entry ID, can you try adding it as URL Title and see if it works now.
It probably doesn’t make any sense, but it could just have been a small quirk with the module being confused…
I see what you’re saying. Actually, yes I did try these things last night. I changed the favorite-add link to use {entry_id} instead of {url_title} and I visited the URL in my browser using entry ID in the URL (since with the url_title in the URL it wouldn’t add/remove since no entry_id was present). I added it and removed it three or four times and then reverted everything back to use {url_title} and tried it once again with the same result of it seeming to recognize it in that once you click “add” it gives you the “added to favorites” message, but it never adds it to the list nor does it update the number on how many times it’s been added as a favorite.
Good call, I renamed it “pieman” and it started working!
It puts it into the favorites list and I can remove it with not problems and the “saves as a favorites x times” number increases when it’s saved and decreases when it’s removed.
The next question is why is this happening? I tried another name just to be sure it wasn’t a fluke and I tried “blah blah blah” and “old stone” (without the “e” on the end of old) for the entry name and yet again it worked perfectly. I changed the entry name back to “Olde Stone” (with the “e”) and it once again stopped working.
I have no idea why this is behanving this way… it’s very unusual…
Can you try to duplicate this with another entry?
Try changing the extension setting back to “Yes” for automatically adding to Favorites when author.
Then Create a new entry, change the setting back to “No” and see if it duplicates the name “symptoms”
While you’re at it, try adding/removing the Olde Stone entry while the Extension setting in back on “Yes”, and then keep the entry removed.
First thing is no, I cannot duplicate this with any other entry. I cannot even duplicate it when creating new entries with different titles and url titles. I tried all of your suggestions with all the same results.
the url-title for this entry is “olde-stone.” I went into the entry and changed “olde-stone” to “old-stone” and it worked fine. I thought that maybe it was something weird with how many characters were there, so I tried “test-stone” since “test” is still four characters. I figured if that was the case it wouldn’t work this way either. “test-stone” worked fine. Once I changed back to “olde-stone” it stopped working again.
Right now I’ve got the title as “Olde Stone” and I’ve manually set the url-title to “old-stone” so that it works, but it seems like it’s got to be a 1 in a million chance bug with these specific characters? I’m not a developer so I really don’t have any idea, but I can’t duplicate the problem unless the url title says “olde-stone”.
EDIT: Just as another test, I created a brand new entry with random words/numbers in all custom fields with a title of “testing” but I changed the url title to “olde-stone” and it reacts the same way as the original problem… doesn’t work. Something weird with that specific url title it seems.
but it seems like it’s got to be a 1 in a million chance bug with these specific characters? I’m not a developer so I really don’t have any idea, but I can’t duplicate the problem unless the url title says “olde-stone”.
Haha, would be interesting…. Mitchell hates “olde-stone” for some reason
See, I didn’t just want to come out and accuse Mitchell of hating Olde Stone, but yeah, that’s what I figured was happening! haha
Ok, as ridiculous as this sounds, olde-stone2 and olde-stone-2 both work perfectly. Change it back to plain old olde-stone and it’s a no go again. WTF!?