Navigation

Pligg Support

Live Answer Submissions
Answer Author Story Ago
Maan it works like a charm! You are perfect! It's great to have you here. user_4343977 Solution fro the sidebar saved stories to display only those belonging to the logged-in user 73 days
**ATTENTION YANKIDANK to uodate the Github*** In \templates\bootstrap\pligg.tpl LINE 174, we find: {include file=$the_template"/functions/bookmark.tpl"} The \templates\bootstrap\functions\bookmark.tpl includes the scripts for the add/remove bookmarks and the ajax call to update the sidebar saved stories. Open \modules\sidebar_saved\update_rightpanel.php 1- On LINE 13 (right before the query) add the following to get the main smarty variable of the logged in user: global $the_template, $main_smarty, $db; $user_logged_id = $main_smarty->get_template_vars('user_logged_id'); Replace the query: $res = "select link_id,link_title,saved_id,saved_user_id,saved_link_id from ".table_links.",".table_saved_links." WHERE saved_link_id = link_id ORDER BY saved_id DESC limit 5"; With this: $res = "select link_id,link_title,saved_id,saved_user_id,saved_link_id from ".table_links.",".table_saved_links." WHERE saved_user_id =$user_logged_id and link_id = saved_link_id ORDER BY saved_id DESC limit 5"; Save and close. NOTE I am still using $user_logged_id to be conform to what I used above in the original fix. If you used YankiDank’s Github commit, then use: global $the_template, $main_smarty, $db; $user_id = $main_smarty->get_template_vars('user_id'); $res = "select link_id,link_title,saved_id,saved_user_id,saved_link_id from ".table_links.",".table_saved_links." WHERE saved_user_id =$user_id and link_id = saved_link_id ORDER BY saved_id DESC limit 5"; Now whenever a story is added/removed, there is no need to refresh as this fix will properly update the sidebar saved stories. redwine Solution fro the sidebar saved stories to display only those belonging to the logged-in user 73 days
@yankidank just write a short how to man! user_7205927 Anybody else besides me (and this site) running Pligg and WordPress together? 73 days
that's just perfect! user_4343977 Fully working implementation to display Total Story Views in the story summary. 74 days
I am glad it's working. I will take a look tomorrow and closely check the refreshing issue and possibly eliminate the need to it. redwine Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
Ok, the solution is to refresh a page, after refreshing page it works fine. :D That's true you were right and I didn't check it. Nevertheless I have strange behaviour on the dynamic part of adding to sidebar saved. When I don't refresh page and I only click to add 1 story to bookmarks it sometimes adds more (for example it still remembers a story that i have added previously,and later removed from bookmarks - and refreshed site). After I refresh site once again it goes back to normal and shows proper stories in 'sidebar saved'. So there is a tiny flaw that could be improved. Please don't get me wrong - I am grateful that you have wrote the code - Thanks very much for your thorough explanation. user_4343977 Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
Furthermore, here is the saved_links table with explanation. (attached) redwine Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
And here are the snapshots redwine Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
"Conclusion: When someone adds to bookmarks a story that is submitted by somebody else then this story shows up on both accounts in sidebar_saved. (on his account and the author of added story account) " That's a completely wrong conclusion my friend! I just added this post as story on my development site by a new user. Then, user redwine added it. It showed in the saved stories for redwine but NOT to Giorgio who submitted the stories. To elaborate more: here is the query to get who saved what and display the stories for each user: $res = "select link_id,link_title,saved_id,saved_user_id,saved_link_id from ".table_links.",".table_saved_links." WHERE saved_user_id =$user_logged_id and link_id = saved_link_id ORDER BY saved_id DESC limit 5"; if you notice in the WHERE clause, we are specifically asking for: WHERE saved_user_id =$user_logged_id This means we are limiting the result to only those stories bookmarked by the logged in user, hence we created the samrty variable in the smartyvariables.php Now if it happens that the submitter of the story bookmarked it and another user bookmarked it as well, then yes it will show to both in the saved stories. Have you tried to refresh the page after bookmarking a story? redwine Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
So, I did a new installation of pligg from github master so I didn't change anything and it still doesn't work. The files are made exactly in a way that 'Yankidank' commited . (So they have right prefixes) Here you have my test case which shows a bug: 1. Create admin account during new installation of pligg. 2. Submit a story from admin account. 3. Register new account : 'user1' 4.Logged in as 'user1' submit a story. So right now you have 2 stories One made by admin and second by user1. 5. While still logged in as 'user1' please add to bookmarks only the story that was submitted by admin (admin is the author). 6. Log out and Log in as admin. 7. Add to bookmarks story that was submitted by user1. 8. Now look to sidebar your sidebar saved storied -> There are 2 stories. Conclusion: When someone adds to bookmarks a story that is submitted by somebody else then this story shows up on both accounts in sidebar_saved. (on his account and the author of added story account) To be exact It will appear on the user account who adds the story (authored by some other person) to his bookmarks (which is good), and on account of the author of that story in sidebar_saved (which is wrong). user_4343977 Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
The only difference between what Yankidank committed and my code here is what he changed the variable I created in the smartyvariables.php. I showed you the snapshots as a proof it is working and obvsiously YankiDank also tried it before committing it. Compare my steps above with what you have changed in your files and let me know. Go through the steps one more time and make sure they are followed correctly! redwine Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
Correction: In the query, I mistakenly left my pligg prefix in it. So please change, In step 7 above: To this: $res = "select link_id,link_title,saved_id,saved_user_id,saved_link_id from ".table_links.",".table_saved_links." WHERE saved_user_id =$user_logged_id and link_id = saved_link_id ORDER BY saved_id DESC limit 5"; redwine Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
Do I get it right? If I have a Pligg 2.0.1 and I change smartyvariables.php and modulessidebar_savedtemplatessidebar_saved_index.tpl according to the changes that 'yankidank' commited on github it should work with no other changes whatsoever ? user_4343977 Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
You must have missed or incorrectly done something. Attached are 2 snapshots for 2 different users showing the save stories for each accordingly! redwine Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
For me it (the improved code from github) still doesn't work well and here's why: 1. There are 2 users : Andrew, John. Both of them have published stories. Right now both of them have empty list of saved stories. When Andrew adds to his saved stories one of stories that has been authored by John he has it in his sidebar and it's OK. When you log in as John and look at John's saved stories sidebar it is OK until John wants to save a story. When he click to save a story then in sidebar there is the story he just saved, and a story that Andrew saved (John is an author of that story, but he didn't add it to his saved stories. This story was saved by Andrew). When you look to "user/andrew/saved/" and "user/john/saved/ " tabs in Andrew or John profiles they have everything right - there are only stories saved by themselves. But there is a bug in sidebar. I'm not that good in programming, but maybe there is a solution to that by using the code that shows properly saved stories from profile tabs and implement them in sidebar. I hope you can understand my case. If something is not clear please ask me. Could you check if my problem is isolated, or this problem is common with the commit form github? Thanks user_4343977 Solution fro the sidebar saved stories to display only those belonging to the logged-in user 74 days
Thanks! That worked wonderfully! pdigangi Change Subnav Category Color When Selected 75 days
On /bootstrap/categories.tpl find: < li{if $cat_array[thecat].principlecat neq 0} class="dropdown"{/if}> then replace with: < li class="{if $cat_array[thecat].principlecat neq 0}dropdown{/if}{if $request_category eq $cat_array[thecat].safename} selected{/if}"> On /bootstrap/css/style.css add: #categories li.selected { background: red; } OxyThemes Change Subnav Category Color When Selected 75 days
Thanks OxyThemes! On a noob level, should I make that change in the index.php and new.php or pligg.tpl file? ~ Paul pdigangi Change Subnav Category Color When Selected 75 days
Use the conditional: {if $request_category eq $cat_array[thecat].safename} selected{/if} then in your CSS just make a .selected class that defines the colors. OxyThemes Change Subnav Category Color When Selected 75 days
I will check how to use github as it should be. I posted these on github too: https://github.com/Pligg/pligg-cms/issues/184 https://github.com/Pligg/pligg-cms/issues/181 redwine Repository for contributions and fixes 83 days