Sep 08, 2008, 10:52 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Read what MODx Developers say: MODx Dev. Blogs
Pages: [1] 2   Go Down
  Print  
Author Topic: Snippet UserComments and UserCommentsCount (SMF)  (Read 10387 times)
0 Members and 2 Guests are viewing this topic.
Mark
Coding Team
*
Posts: 3,247


Ditto Developer


WWW
« on: Apr 06, 2006, 10:29 PM »

Since the origional files seem to have become corrupted, here is another copy of the snippets released in the Snippet Time post over in the MODx Blog. Please remove and php start or end tags in the documents (IE <? or <?php)

* SMF_UserComments.txt (9.25 KB - downloaded 1244 times.)
* UserCommentsCount.txt (0.91 KB - downloaded 787 times.)
« Last Edit: Apr 06, 2006, 10:34 PM by Mark » Logged

OncleBen31
Sr. Member
****
Posts: 283


I believe in MODx!


WWW
« Reply #1 on: Apr 07, 2006, 02:58 AM »

Thanks Mark,

Just be carefull, there is a "<?" tag at the beginning of SMF_UserComments that we should delete.  Wink
Logged
Mark
Coding Team
*
Posts: 3,247


Ditto Developer


WWW
« Reply #2 on: Apr 07, 2006, 02:28 PM »

Please remove and php start or end tags in the documents (IE <? or <?php)
Logged

garryn
Coding Team
*
Posts: 1,114



WWW
« Reply #3 on: May 16, 2006, 06:46 PM »

Hi all,

Recently, I've been playing about this snippet and realised that perhaps a few installation instructions might be handy for some people.

So, here you go - feel free to comment on anything, I'm hoping that the advice is useful to people who don't necessarily know the in's and out's of MODx and PHP:

SMF UserComments setup

Installation (if you haven't already installed SMF and the snippet)

1.   Download and extract SMF 1.1RC2 into a folder at the root of your website.
2.   Run the SMF installer and complete all the necessary information. (The installer will try and create a database if one doesn’t exist already)
3.   Download and insert the SMF_UserComments code into a new snippet.

Fixing SMF

1.   In your SMF install, edit lines 1782 to 1787 of Sources/load.php to be:

Code:
// Attempt to change a few PHP settings.
 if (session_id() == '') {
@ini_set('session.use_cookies', true);
@ini_set('session.use_only_cookies', false);
@ini_set('url_rewriter.tags', '');
@ini_set('session.use_trans_sid', false);
@ini_set('arg_separator.output', '&amp;');
}

2.   Log into SMF and check the following setting in the admin (I found this caused a few issues with my setup):

  • Configuration->Server Settings->Feature Configuration Tab->Enable local storage of cookies: Set to off.

Setting up the template

1.   Create a TV (name of your choice) and assign it to the template that will form the blog/repository pages.
2.   Use the snippet call in the TV to add the commenting to the pages.
3.   To display the forum user name instead of the logged-in user (which in most cases will be ‘anonymous’), look for the [+user+] in the default output for the snippet and change to [+forumuser+].
4.   The path back to the forum login is also hardcoded, so if you have the forum install in a sub-directory or under a different folder name then this will need editing in the snippet code as well.

Hope that helps,

Garry
Logged

OncleBen31
Sr. Member
****
Posts: 283


I believe in MODx!


WWW
« Reply #4 on: May 17, 2006, 01:56 AM »


Fixing SMF

1.   In your SMF install, edit lines 1782 to 1787 of Sources/load.php to be:

Code:
// Attempt to change a few PHP settings.
 if (session_id() == '') {
@ini_set('session.use_cookies', true);
@ini_set('session.use_only_cookies', false);
@ini_set('url_rewriter.tags', '');
@ini_set('session.use_trans_sid', false);
@ini_set('arg_separator.output', '&amp;');
}

Why this mod is necessary ?

Setting up the template

1.   Create a TV (name of your choice) and assign it to the template that will form the blog/repository pages.
2.   Use the snippet call in the TV to add the commenting to the pages.
3.   To display the forum user name instead of the logged-in user (which in most cases will be ‘anonymous’), look for the [+user+] in the default output for the snippet and change to [+forumuser+].
4.   The path back to the forum login is also hardcoded, so if you have the forum install in a sub-directory or under a different folder name then this will need editing in the snippet code as well.

I don't really undestand what is the role of the TV ?

Thanks trying to help for this module Garry Grin
Logged
garryn
Coding Team
*
Posts: 1,114



WWW
« Reply #5 on: May 17, 2006, 04:02 AM »

Hi,
Quote
Why this mod is necessary ?
SMF will always attempt to create a new session regardless of whether the forum is accessed directly or using SSI - the SSI case will conflict with MODx's own session handling and that is why the fix is used. It basically checks to see if a session has already been started before attempting to set any values.
Quote
I don't really undestand what is the role of the TV ?
The TV is just one of many ways to include the User Comments into a site. The reason I chose to use a TV is because it provides a lot of flexibility in terms of what pages have User Comments included (for example, there may some pages on a site where User Comments are not required - Site Map, Search Results etc.)

There's always more than one way to do things so it's purely down to choice as to what method is used for including the User Comments.

Hope that helps, Garry
Logged

OncleBen31
Sr. Member
****
Posts: 283


I believe in MODx!


WWW
« Reply #6 on: May 17, 2006, 08:55 AM »

Thanks for the explanations  Grin

And you know what I've just experimented the problem with the load.php file on my local site. Wired I didn't notice it on my on-line site  Huh
Logged
zatoichi
Jr. Member
*
Posts: 30



« Reply #7 on: Jul 08, 2006, 05:41 PM »

Does this use the forum to store comments or modx?

I kind of like the idea of using the forum for comments and modx for the post.
Logged

"Adversus solem ne loquitor." -don't speak against the sun (don't waste your time arguing the obvious) Something I sometimes need to be reminded of.
Mark
Coding Team
*
Posts: 3,247


Ditto Developer


WWW
« Reply #8 on: Jul 09, 2006, 01:57 AM »

Modx
Logged

myeviltwin
Jr. Member
*
Posts: 27


WWW
« Reply #9 on: Aug 01, 2006, 03:57 PM »

Is it possible to pull out a forumuser's website in a tag like [+userwebsite+] or sth like this?
Logged
Mark
Coding Team
*
Posts: 3,247


Ditto Developer


WWW
« Reply #10 on: Aug 01, 2006, 09:29 PM »

It was not coded that way but you may be able to. Try print_r(); the SMF array and see what values you can find.
Logged

edipo
Sr. Member
****
Posts: 319



« Reply #11 on: Apr 05, 2007, 07:17 AM »

Fixing SMF

1.   In your SMF install, edit lines 1782 to 1787 of Sources/load.php to be:

Code:
// Attempt to change a few PHP settings.
 if (session_id() == '') {
@ini_set('session.use_cookies', true);
@ini_set('session.use_only_cookies', false);
@ini_set('url_rewriter.tags', '');
@ini_set('session.use_trans_sid', false);
@ini_set('arg_separator.output', '&amp;');
}
This is for SMF 1.1 RC2, how can I fix SMF 1.1.2 ?
Logged

Sorry for my bad English  Grin
Mark
Coding Team
*
Posts: 3,247


Ditto Developer


WWW
« Reply #12 on: Apr 05, 2007, 07:21 AM »

It should be the same except the line numbers will be different. Just search for those lines and you'll find them.
Logged

edipo
Sr. Member
****
Posts: 319



« Reply #13 on: Apr 05, 2007, 07:25 AM »

I have found the code but it is a little bit different:
// Attempt to change a few PHP settings.
	
@
ini_set('session.use_cookies', true);
	
@
ini_set('session.use_only_cookies', false);
	
@
ini_set('url_rewriter.tags', '');
	
@
ini_set('session.use_trans_sid', false);
	
@
ini_set('arg_separator.output', '&amp;');

	
if (!empty(
$modSettings['globalCookies']))
« Last Edit: Apr 05, 2007, 07:34 AM by edipo » Logged

Sorry for my bad English  Grin
Mark
Coding Team
*
Posts: 3,247


Ditto Developer


WWW
« Reply #14 on: Apr 05, 2007, 07:27 AM »

Ok, use this:
	

 if (
session_id() == '') {
@
ini_set('session.use_cookies', true);
@
ini_set('session.use_only_cookies', false);
@
ini_set('url_rewriter.tags', '');
@
ini_set('session.use_trans_sid', false);
@
ini_set('arg_separator.output', '&amp;');
}
Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!