Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 23, 2012, 07:02:19 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Interested in joining the WebsiteBaker team?
For more Information read
here
or on our
new website
.
155439
Posts in
21702
Topics by
7755
Members
Latest Member:
Smacki
WebsiteBaker Community Forum
English
Help & Support
(Moderators:
Argos
,
badknight
)
News module, Guest read only comments, logged in can add ???
Pages: [
1
]
Go Down
Author
Topic: News module, Guest read only comments, logged in can add ??? (Read 2136 times)
fsuk
Offline
Posts: 127
News module, Guest read only comments, logged in can add ???
«
on:
August 19, 2008, 01:24:42 PM »
Is it possible to set up news comments so that guests can read the comments but not add and registered users can add and view?
Currently it looks like there are 3 options:
Disabled
Public - Any one can read and add comments
Private - Only registerd users can view and add
I need something in between. Any ideas?
Logged
You say deviant like its a bad thing...
trev_rock
Offline
Posts: 4
Re: News module, Guest read only comments, logged in can add ???
«
Reply #1 on:
April 03, 2009, 05:43:22 PM »
Hey fsuk,
First time I've ever made a forum post, but I found a solution that worked for me, so thought I would pass it along. (I should mention here that my PHP ability is lacking, but this is a start).
I edited the view.php file of the news module to change where it looked for whether the user is logged in. In essence it displays all the comments no matter what, but checks to see if the person is logged in before offering the 'Add Comment' link. If their not logged in it also shows a link to register.
Here's the view.php from line 311 on:
Code:
// Show comments section if we have to
if($post['commenting'] == 'private') {
// Print comments header
if(isset($wb) AND $wb->is_authenticated() == true){
echo str_replace('[ADD_COMMENT_URL]', WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $setting_comments_header);
} else {
echo '<br /><br /><br /><h2>Comments</h2>';
echo '<h3>Want to Participate in the discussion, <a href="account/signup.php" >SIGN UP!</a></h3><br />';
echo '<table cellpadding="2" cellspacing="0" border="0" width="98%">';
}
// Query for comments
$query_comments = $database->query("SELECT title,comment,commented_when,commented_by FROM ".TABLE_PREFIX."mod_news_comments WHERE post_id = '".POST_ID."' ORDER BY commented_when ASC");
if($query_comments->numRows() > 0) {
while($comment = $query_comments->fetchRow()) {
// Display Comments without slashes, but with new-line characters
$comment['comment'] = nl2br(($comment['comment']));
$comment['title'] = ($comment['title']);
// Print comments loop
$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
$uid = $comment['commented_by'];
$vars = array('[TITLE]','[COMMENT]','[DATE]','[TIME]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
$values = array(($comment['title']), ($comment['comment']), $commented_date, $commented_time, $uid, ($users[$uid]['username']), ($users[$uid]['display_name']), ($users[$uid]['email']));
} else {
$values = array(($comment['title']), ($comment['comment']), $commented_date, $commented_time, '0', strtolower($TEXT['UNKNOWN']), $TEXT['UNKNOWN'], '');
}
echo str_replace($vars, $values, $setting_comments_loop);
}
} else {
// Say no comments found
if(isset($TEXT['NONE_FOUND'])) {
echo $TEXT['NONE_FOUND'].'<br />';
} else {
echo 'None Found<br />';
}
}
if(isset($wb) AND $wb->is_authenticated() == true){
// Print comments footer
echo str_replace('[ADD_COMMENT_URL]', WB_URL.'/modules/news/comment.php?id='.POST_ID.'&sid='.$section_id, $setting_comments_footer);
} else {
echo '</table>';
}
}
Hopefully somebody can clean it up and make it better.
Hope it helps!
Logged
djdeeno
Offline
Posts: 51
Re: News module, Guest read only comments, logged in can add ???
«
Reply #2 on:
April 28, 2009, 09:31:51 PM »
Hi
I have the same problem, wel problem mmmm
I want that all people can see the commenst but register when tha want to add a comment
i have try to replace the txt with this code but it does't help.
I have wb 2.7, maybe can somebody copy paste some code so can try it?
Logged
trev_rock
Offline
Posts: 4
Re: News module, Guest read only comments, logged in can add ???
«
Reply #3 on:
April 29, 2009, 11:15:17 AM »
Hey djdeeno,
Where did you post that code?
Can you explain a little more where you put the code and what happens now that you put it in?
Logged
djdeeno
Offline
Posts: 51
Re: News module, Guest read only comments, logged in can add ???
«
Reply #4 on:
April 29, 2009, 01:39:16 PM »
hey,
sure i can, i copy and paste the code in the view.php, the view.php file in the modules\news dir.
So where "// Show comments section if we have to" begin till the end at the file.
Now the newspage is still on but no items/news are avaible now.
U can see the page/site online:
http://www.webcentre.nl/kaagloop/pages/nieuws.php
And u can see the code here:
http://www.webcentre.nl/kaagloop/modules/news/view.txt
«
Last Edit: April 29, 2009, 01:42:05 PM by djdeeno
»
Logged
djdeeno
Offline
Posts: 51
Re: News module, Guest read only comments, logged in can add ???
«
Reply #5 on:
May 02, 2009, 01:25:20 AM »
Nobody know some answers?
i have post it on diffrents sites/forums and no one response
maybe a little tip?
thanks
Logged
trev_rock
Offline
Posts: 4
Re: News module, Guest read only comments, logged in can add ???
«
Reply #6 on:
May 03, 2009, 08:17:44 PM »
Hello again,
I took a look at your file vs. mine, and everything is done the exact same, so perhaps the issue is not with the code.
What are the settings on the different posts? Have you enabled Comments? Are they members only? Let me know what those settings are and hopefully we can find an answer.
Thanks
Logged
djdeeno
Offline
Posts: 51
Re: News module, Guest read only comments, logged in can add ???
«
Reply #7 on:
May 08, 2009, 04:09:27 PM »
Hello
Wel maybe u see the website, when i was worked on it, but you can see, there is no news, oke the pages is stille there, and template works, but all the news is gone when i use this view.php
http://www.webcentre.nl/kaagloop/modules/news/view.txt
This is the origanal view.php, when i use this, all the news is visable.
http://www.webcentre.nl/kaagloop/modules/news/view_or.txt
This must be a php code error i think.
But is there no on who has this work? See reactions on news items but register when u want too place a reaction?
Thanks
Logged
djdeeno
Offline
Posts: 51
Re: News module, Guest read only comments, logged in can add ???
«
Reply #8 on:
May 25, 2009, 02:59:43 PM »
i have see this option never before, so i think its not poisable to see comments from register user when u not log in. maybe making a new blog or news system?
Logged
djdeeno
Offline
Posts: 51
Re: News module, Guest read only comments, logged in can add ???
«
Reply #9 on:
July 01, 2009, 06:38:43 PM »
No one a idea How to make this?
Thanks
Deeno
Logged
pcwacht
AddOn Development
Offline
Posts: 2856
Re: News module, Guest read only comments, logged in can add ???
«
Reply #10 on:
June 22, 2010, 07:30:47 PM »
Solution for those needed one:
http://www.websitebaker2.org/forum/index.php/topic,18573.0.html
Have fun,
John
Logged
http://www.ictwacht.nl
= Dutch ICT info
http://www.pcwacht.nl
= My first
both still work in progress, since years.....
Pages: [
1
]
Go Up
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> WebsiteBaker Website Showcase
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.9
===> Announcements
===> Help/Support
=====> Modules / Extensions
===> Suggestions
===> Software bugs
=> Help & Support
=> Modules
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
=> jQuery
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
=> Archive (posts up to 2007)
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> WebsiteBaker 2.9
===> Ankündigungen
===> Hilfe/Support
=====> Module / Extensions
===> Vorschläge
===> Softwarefehler
===> Erfahrungs und Testberichte
=> Hilfe/Support
=> Module & Snippets
=> Templates & Design
=> Tutorials
=> jQuery
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
-----------------------------
Bakery (WB shop module)
-----------------------------
=> Bakery English
=> Bakery Deutsch
-----------------------------
KeepInTouch (Multi Contact Module)
-----------------------------
=> KeepInTouch English
=> KeepInTouch Deutsch
Loading...