Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2011-12-14 18:59:32

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

On one site, I used the ign_pwp to detect whether the reader is logged in before leaving a comment, and remove unnecessary fields for logged-in users:

<txp:ign_if_logged_in>
<input type="hidden" value="<txp:ign_user_info type="realname" />" name="name" class="comment_name_input" id="name" />
<txp:else/>
<div <txp:if_cookie>class="comment-cookie"</txp:if_cookie>>
<label for="name" class="label-required">Your name</label>
<txp:comment_name_input />
</div>
</txp:ign_if_logged_in>

<txp:ign_if_logged_in>
<input type="hidden" value="<txp:ign_user_info type="email" />" name="email" class="comment_email_input" id="email" />
<txp:else/>
<div <txp:if_cookie>class="comment-cookie"</txp:if_cookie>>
<label for="email" class="label-required">Your email (will not be published)</label>
<txp:comment_email_input />
</div>
</txp:ign_if_logged_in>

Offline

#38 2011-12-14 19:01:31

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

The above code was in the default comment_form comment-type form for that site, and no mem_form tags were used or abused in this instance.

Offline

#39 2011-12-15 10:36:06

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

<txp:comments_error wraptag="ul" break="li" />
<table cellpadding="4" cellspacing="0" border="0">
<tr><td align="right">
<label for="name"><txp:text item="comment_name" /></label></td>
<td><txp:comment_name_input />
<txp:comment_remember /></td>
</tr>
<tr><td align="right">
<label for="email"><txp:text item="comment_email" /></label></td>
<td>
<txp:comment_email_input />
</td>
</tr>
<tr>
<td align="right">
<label for="web"><txp:text item="comment_web" /></label></td>
<td><txp:comment_web_input /></td>
</tr><tr>
<td align="right">
<label for="message"><txp:text item="comment_message" /></label></td>
<td><txp:comment_message_input />
<div id="comments-help"><txp:comments_help /></div>
</td></tr><tr>
<td></td><td>
<txp:comment_preview />
<txp:comment_submit />
</td>
</tr>
</table>

My form (default COMMENT_FORM)

johnstephens, dunno why, but your form dont work. And I cant find IGN_PWP anywhere.

Last edited by elwins (2011-12-15 10:37:19)

Offline

#40 2011-12-15 11:47:32

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

elwins wrote:

And I cant find IGN_PWP anywhere.

ign_pwp = ign_password_protect, you’ve installed it already ;)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#41 2011-12-15 13:00:18

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

I’m sorry if my comment muddied the waters. The site in which I used that comment form didn’t use TXPhorum.

But having TXPhorum installed shouldn’t prevent the comment form from working, even if though TXPhorum isn’t designed to use comments. Did you call the comment form using a <txp:comments_form /> tag somewhere in article context?

Offline

#42 2011-12-15 13:44:19

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

yes, if I use originall form, then shows original comment form.

Offline

#43 2011-12-15 14:18:55

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

Did you add a comment_message_input? I didn’t copy that part of my code, and the other inputs would be ommitted if you looked at it while logged in.

Offline

#44 2011-12-15 14:47:13

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

<txp:comments_error wraptag="ul" break="li" />
<txp:ign_if_logged_in>
<input type="hidden" value="<txp:ign_user_info type="realname" />" name="name" class="comment_name_input" id="name" />
<txp:else/>
<div <txp:if_cookie>class="comment-cookie"</txp:if_cookie>>
<label for="name" class="label-required">Your name</label>
<txp:comment_name_input />
</div>
</txp:ign_if_logged_in>
<txp:ign_if_logged_in>
<input type="hidden" value="<txp:ign_user_info type="email" />" name="email" class="comment_email_input" id="email" />
<txp:else/>
<div <txp:if_cookie>class="comment-cookie"</txp:if_cookie>>
<label for="email" class="label-required">Your email (will not be published)</label>
<txp:comment_email_input />
</div>
<label for="message"><txp:text item="comment_message" /></label>
<txp:comment_message_input />
<txp:comments_help /></div>
<txp:comment_preview />
<txp:comment_submit />
</txp:ign_if_logged_in>

If I am logged in, then nothing shows, If I am offline, comment form shows.

Last edited by elwins (2011-12-15 14:47:38)

Offline

#45 2011-12-15 14:50:33

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

elwins wrote:

when I post new Article in forum, then reply messages are making like articles too, but is there some possible way, how to using default TXP comment system.

I don’t think so. Ben, the TXPhorum author set it up to work that way so if you want to use comments, you’ll have to recode parts of the plugin.


TXP Builders – finely-crafted code, design and txp

Offline

#46 2011-12-15 15:10:57

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

You have to move this block outside the ign_if_logged_in conditional:

<label for="message"><txp:text item="comment_message" /></label>
<txp:comment_message_input />
<txp:comments_help /></div>
<txp:comment_preview />
<txp:comment_submit />

Also, I just noticed if_cookie is not a native tag— despite appearances, it belongs to the czg_if_comment_cookies plugin. If you don’t have that plugin, you should get rid of the if_cookie tags.

Offline

#47 2011-12-15 16:08:38

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

thanks, now I understand 100%, how working this code. Big thanks! :)

Offline

#48 2011-12-17 03:22:11

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: [plugin] [ORPHAN] TXPhorum 0.3 / A simple forum solution for Textpattern

// =================
// TXPhorum
// A simple forum solution for Textpattern
// Test site and instructions: http://www.benbruce.com/txphorum
// Support forum thread: http://forum.textpattern.com/viewtopic.php?id=20775
register_callback('txphorum_mem','mem_form.submit');
function txphorum_mem_preferences($what)
{
	$lang = array(
		'section'           => 'forums',
		'reply_section'           => 'forums_replies',
		'category'           => 'category name is here..',
		'parent_custom_field'           => 'custom1',
	);
	return $lang[$what];
}
function txphorum_mem()
{
	global $mem_form_values;
//---- check if this IS a txphorum_mem submit; if not, return
// currently using Body to check for this
	if (!$mem_form_values['txphorum_mem_Body']) { 
		return; 
	}
	else { // this IS a txphorum_mem submit
		include_once txpath.'/lib/classTextile.php';
		$textile = new Textile();
		$lite = 0;
		$noimage = 0;
		extract($mem_form_values);
		$date_and_time = date("F j, Y, g:i a");
		if (!$txphorum_mem_Author) {
			$txphorum_mem_Author = 'Guest';
		}
		if ($txphorum_mem_Title == '?') {
				$txphorum_mem_Title = "question: $date_and_time";
		}
		if ($txphorum_mem_Title == '/') {
				$txphorum_mem_Title = "slash: $date_and_time";
		}
		$txphorum_mem_Body_html = $textile->TextileRestricted($txphorum_mem_Body, $lite, $noimage);
		// check if gps('edit')
		if (gps('edit')) {
			$txphorum_mem_id = gps('edit');
			safe_update(
				"textpattern",
				"Body            = '$txphorum_mem_Body',
				Body_html       = '$txphorum_mem_Body_html'",
				"ID=$txphorum_mem_id"
			); 
			return;
		}
// put in "if !$txphorum_mem_section then preferences etc (will allow for setting these with mem_form_secret if you like
		$section = txphorum_mem_preferences('section');
		$category1 = txphorum_mem_preferences('category');
		$when = 'now()';
			if ($txphorum_mem_Parent) {
			$section = txphorum_mem_preferences('reply_section'); // overwriting $section
			$txphorum_mem_Title = "$txphorum_mem_Author reply to $txphorum_mem_Parent on $date_and_time";
			$thecount = safe_field('count(*)','textpattern','custom_1='.$txphorum_mem_Parent);
			$thecount = assert_int($thecount);
			$thecount = $thecount+1;
			$updated = safe_update('textpattern','comments_count='.$thecount,'ID='.$txphorum_mem_Parent);
			$updated_b = safe_update('textpattern','lastMod=' . $when,'ID='.$txphorum_mem_Parent);
		}
		$url_title = stripSpace($txphorum_mem_Title, 1);
		safe_insert(
			   "textpattern",
			   "Title           = '$txphorum_mem_Title',
				Body            = '$txphorum_mem_Body',
				Body_html       = '$txphorum_mem_Body_html',
				Excerpt         = '',
				Excerpt_html    = '',
				Image           = '',
				Keywords        = '',
				Status          = '4',
				Posted          = $when,
				LastMod         = now(),
				AuthorID        = '$txphorum_mem_Author',
				Section         = '$section',
				Category1       = '$category1',
				Category2       = '',
				textile_body    = '1',
				textile_excerpt = '1',
				Annotate        = '0',
				override_form   = '',
				url_title       = '$url_title',
				AnnotateInvite  = 'Comment',
				custom_1        = '$txphorum_mem_Parent',
				custom_2        = '',
				custom_3        = '',
				custom_4        = '',
				custom_5        = '',
				custom_6        = '',
				custom_7        = '',
				custom_8        = '',
				custom_9        = '',
				custom_10       = '',
				uid				= '".md5(uniqid(rand(),true))."',
				feed_time		= now()"
		); 
		$thecount ='';
		$txphorum_mem_Parent= '';
	}
}
function txphorum_original_body() {
	$edit = gps('edit');
	$txphorum_original_body = fetch('Body','textpattern','ID',"$edit");
	return $txphorum_original_body;
}
function bab_link($atts) {
	extract(lAtts(array(
		'name' => 'txphorum_index',
	),$atts));
	$bab_link = fetch('url','txp_link','linkname',"$name");
	return $bab_link;
}
function bab_parent($atts) {
	global $thisarticle;
	$field = txphorum_mem_preferences('parent_custom_field');
	$id = $thisarticle[$field];
	if (!$id) { $id = $thisarticle['thisid']; }
	extract(lAtts(array(
		'display' => 'ID',
	),$atts));
	$parents = safe_row('*','textpattern',"ID='$id'");
	extract($parents); 
	return $$display;
}
function bab_author($atts)
{
	global $thisarticle;
	extract(lAtts(array(
		'type' => '0',
	),$atts));
	$author = $thisarticle['authorid']; 
	if ($type == '1') {
		$author = safe_field('RealName', 'txp_users', "name = '$author'");
	}
	return $author;
}
function bab_if_author($atts, $thing) {
	global $thisarticle, $ign_user;
	$bab_author = $thisarticle['authorid'];
	if(!$bab_author) {$bab_author = 'Guest'; }
	if ($ign_user == $bab_author) { $number = '1'; } else { $number = '0'; }
	return parse(EvalElse($thing, ("$number" > 0 )));
}
function bab_if_gps($atts, $thing) {
	extract(lAtts(array(
		'check_for' => 'edit',
	),$atts));
	if (gps($check_for)) { $number = 1; } else { $number = 0; }
	return parse(EvalElse($thing, ("$number" > 0)));
}
if ( @txpinterface == 'admin' ) {
	if (gps('install_txphorum')) {
		// style: -- base64'ed		
		$create_sql[] = "INSERT INTO `".PFX."txp_css` VALUES ('txphorum', 'Ym9keSB7DQoJZm9udC1mYW1pbHk6dmVyZGFuYSBzYW5zLXNlcmlmOw0KCWZvbnQtc2l6ZToxNHB4Ow0KfQ0KI3R4cGhvcnVtX21hc3RlciB7IH0NCiN0eHBob3J1bV9tYXN0ZXIgZmllbGRzZXQgew0KCXBhZGRpbmc6MTBweDsNCgl3aWR0aDo3MCUNCn0NCiN0eHBob3J1bV9tYXN0ZXIgbGVnZW5kIHsNCgl0ZXh0LWFsaWduOnJpZ2h0Ow0KfQ0KI3R4cGhvcnVtX21hc3RlciBsZWdlbmQsIGEgew0KCWZvbnQtd2VpZ2h0OmJvbGQ7DQp9DQojdHhwaG9ydW1fbWFzdGVyIHRleHRhcmVhIHsNCgloZWlnaHQ6ODBweDsNCgl3aWR0aDo3MCU7DQp9DQoNCgkjdHhwaG9ydW1fc2VhcmNoX2xvZ2luX2NvbnRhaW5lciB7DQoJCW1hcmdpbjoxMHB4Ow0KCQltYXJnaW4tcmlnaHQ6MzAlOw0KCX0NCgkJI3R4cGhvcnVtX3NlYXJjaCB7IH0NCgkJI3R4cGhvcnVtX2xvZ2luIHsNCgkJCXRleHQtYWxpZ246cmlnaHQ7DQoJCQlmbG9hdDpyaWdodDsNCgkJfQ0KCSN0eHBob3J1bV9zZWFyY2hfcmVzdWx0c19jb250YWluZXIgew0KCQltYXJnaW4tYm90dG9tOjEwcHg7DQoJfQ0KCSN0eHBob3J1bV9hcnRpY2xlX2NvbnRhaW5lciB7DQoJCW1hcmdpbi1ib3R0b206MTBweDsNCgl9DQoJI3R4cGhvcnVtX2FydGljbGVfY29udGFpbmVyIGRpdnsNCgkJbWFyZ2luLWJvdHRvbToxMHB4Ow0KCX0NCgkJI3R4cGhvcnVtX3BhZ2luYXRlX29sZGVyIHsNCgkJCXRleHQtYWxpZ246cmlnaHQ7DQoJCQlmbG9hdDpyaWdodDsNCgkJCXBhZGRpbmctcmlnaHQ6MjBweDsNCgkJfQ0KCQkjdHhwaG9ydW1fcGFnaW5hdGVfbmV3ZXIgew0KCQkJdGV4dC1hbGlnbjpsZWZ0Ow0KCQkJcGFkZGluZy1sZWZ0OjIwcHg7DQoJCX0NCgkJI3R4cGhvcnVtX3Bvc3RfY29udGFpbmVyew0KCQkJcGFkZGluZzoxMHB4Ow0KCQkJcGFkZGluZy1ib3R0b206MHB4Ow0KCQl9DQoJCS50eHBob3J1bV9yZXBseV9jb250YWluZXIgew0KCQkJbWFyZ2luLWxlZnQ6NDBweDsNCgkJCWJvcmRlci10b3A6MXB4IGRvdHRlZCBncmV5Ow0KCQkJcGFkZGluZzoxMHB4Ow0KCQkJcGFkZGluZy1ib3R0b206MHB4Ow0KCQl9DQoJCSN0eHBob3J1bV9lZGl0X2NvbnRhaW5lciB0ZXh0YXJlYXsNCgkJCWhlaWdodDo0MDBweDsNCgkJCW1hcmdpbi1ib3R0b206N3B4Ow0KCQl9DQoJCS50eHBob3J1bV9hdXRob3JfcG9zdGVkIHsNCgkJCWZvbnQtd2VpZ2h0OmJvbGQ7DQoJCX0NCgkJLnR4cGhvcnVtX2VkaXRfcmVwb3J0IHsNCgkJCXRleHQtYWxpZ246cmlnaHQ7DQoJCX0NCgkjdHhwaG9ydW1fZGlzY3Vzc2lvbl9jb250YWluZXIgew0KCQltYXJnaW4tYm90dG9tOjEwcHg7DQoJfQ0KCSN0eHBob3J1bV9kaXNjdXNzaW9uX2NvbnRhaW5lciBkaXZ7DQoJCW1hcmdpbi1ib3R0b206MTBweDsNCgl9DQoJI3R4cGhvcnVtX2JvdHRvbV9jb250YWluZXIgew0KCQltYXJnaW46MTBweDsNCgkJbWFyZ2luLXJpZ2h0OjMwJTsNCgkJdGV4dC1hbGlnbjpyaWdodDsNCgl9DQoNCi50eHBob3J1bV90ZXh0aWxlX2hlbHAgew0KCWJvcmRlcjoxcHggaW5zZXQgZ3JheTsNCglwYWRkaW5nOjVweDsNCgl3aWR0aDo3MCU7DQoJbWFyZ2luLWxlZnQ6MTc1cHg7DQp9DQoubGFiZWwgew0KCXRleHQtYWxpZ246cmlnaHQ7DQoJZmxvYXQ6bGVmdDt3aWR0aDoxNzVweDsNCn0NCi5tZW1faW5wdXQgew0KCW1hcmdpbi1ib3R0b206N3B4Ow0KfQ0KLnRhZ2xpbmUgew0KCXRleHQtYWxpZ246cmlnaHQ7DQoJZm9udC1zdHlsZTppdGFsaWM7DQp9DQoudGV4dC1hbGlnbl9yaWdodCB7DQoJdGV4dC1hbGlnbjpyaWdodDsNCn0NCi50YWdsaW5lX2lucHV0IHsNCgl3aWR0aDo0MDBweDsNCn0NCi50eHBob3J1bV9zdWJtaXQgew0KCW1hcmdpbi1sZWZ0OjE3NXB4Ow0KfQ0KLnR4cGhvcnVtX2VkaXRfdGV4dGFyZWF7DQoJaGVpZ2h0OjQwMHB4Ow0KfQ==')";
// page: \" and \' and \r\n returns and \t tabs		
$create_sql[] = "INSERT INTO `".PFX."txp_page` VALUES ('txphorum', '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\r\n<head>\r\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n\t<meta http-equiv=\"cache-control\" content=\"no-cache\" />\r\n\r\n\t<title><txp:page_title /></title>\r\n\r\n\t<txp:feed_link flavor=\"atom\" format=\"link\" label=\"Atom\" />\r\n\t<txp:feed_link flavor=\"rss\" format=\"link\" label=\"RSS\" />\r\n\r\n\t<txp:css format=\"link\" />\r\n</head>\r\n\r\n<body>\r\n\r\n<div id=\"txphorum_master\">\r\n\r\n<!-- #### Row 1: search and login/manage -->\r\n\r\n\t<div id=\"txphorum_search_login_container\">\r\n\r\n\t\t<div id=\"txphorum_login\">\r\n\t\t\t<txp:ign_if_logged_in>\r\n\t\t\t\t<a href=\"<txp:bab_link name=\"txphorum_manage_profile\" />\">Update your profile</a> or <txp:ign_logout_link>Logout</txp:ign_logout_link>\r\n\t\t\t<txp:else />\r\n\t\t\t\t<txp:ign_show_login form=\"txphorum_login_form\" />\r\n\t\t\t</txp:ign_if_logged_in>\r\n\t\t</div><!-- /txphorum_login -->\r\n\r\n\t\t<div id=\"txphorum_search\">\r\n\t\t\t<form method=\"get\" action=\"<txp:bab_link name=\"txphorum_index\" />\">Search: <input type=\"text\" name=\"q\" value=\"\" size=\"20\" /></form>\r\n\t\t</div><!-- /txphorum_search -->\r\n\r\n\t</div><!-- /txphorum_search_login_container -->\r\n\r\n\t<txp:if_search>\r\n\r\n<!-- #### Row 2 (a): search results -->\r\n\r\n\t\t<div id=\"txphorum_search_results_container\">\r\n\r\n\t\t\t<fieldset>\r\n\t\t\t\t<legend><a href=\"<txp:bab_link name=\"txphorum_index\" />\">Discussions</a> / Search Results&nbsp;</legend>\r\n\t\t\t\t<txp:article searchall=\"0\" />\r\n\r\n\t<txp:else />\r\n\r\n<!-- #### Row 2 (b): index or edit/article. if edit, show edit form or not allowed -->\r\n\r\n\t\t<div id=\"txphorum_article_container\">\r\n\r\n\t\t\t<fieldset>\r\n\t\t\t\t<txp:if_individual_article>\r\n\t\t\t\t\t<txp:article form=\"txphorum_post\" />\r\n\t\t\t\t<txp:else /><!-- if_individual_article -->\r\n\t\t\t\t\t<legend>Discussions&nbsp;</legend>\r\n\t\t\t\t\t<ul><txp:article form=\"txphorum_index\" limit=\"10\" sort=\"LastMod desc\" /></ul>\r\n\t\t\t\t\t<div id=\"txphorum_paginate_older\"><txp:older>More discussions --></txp:older></div>\r\n\t\t\t\t\t<div id=\"txphorum_paginate_newer\"><txp:newer><-- More discussions</txp:newer></div>\r\n\t\t\t\t</txp:if_individual_article>\r\n\r\n\t</txp:if_search>\r\n\r\n\t\t\t</fieldset>\r\n\r\n\t\t</div><!-- /txphorum_search_results_container or /txphorum_article_container -->\r\n\r\n<txp:ign_if_logged_in>\r\n<!-- #### Row 3: Begin a/Add to the Discussion -->\r\n\r\n\t<txp:if_section name=\"txphorum\" >\r\n\t\t<txp:bab_if_gps check_for=\"edit\">\r\n\t\t\t<!-- nothing -->\r\n\t\t<txp:else />\r\n\r\n\t\t\t<div id=\"txphorum_discussion_container\">\r\n\r\n\t\t\t\t<fieldset>\r\n\t\t\t\t\t<txp:if_individual_article>\r\n\t\t\t\t\t\t<legend>Add to the Discussion&nbsp;</legend>\r\n\t\t\t\t\t<txp:else />\r\n\t\t\t\t\t\t<legend>Begin a Discussion&nbsp;</legend>\r\n\t\t\t\t\t</txp:if_individual_article>\r\n\r\n\t\t\t\t\t<txp:asy_wondertag><txp:mem_form type=\"form\" redirect=\"<txp:page_url />\" form=\"txphorum_discussion_form\" /></txp:asy_wondertag>\r\n\r\n\t\t\t\t</fieldset>\r\n\r\n\t\t\t</div><!-- txphorum_discussion_container -->\r\n\r\n\t\t</txp:bab_if_gps>\r\n\t</txp:if_section>\r\n</txp:ign_if_logged_in>\r\n<!-- #### Row 4: Guidelines, Help, etc -->\r\n\r\n\t<div id=\"txphorum_bottom_container\">\r\n\r\n\t\t<a href=\"<txp:bab_link name=\"txphorum_manage_help\" />\">Help</a> | <a href=\"<txp:bab_link name=\"txphorum_manage_guidelines\" />\">Guidelines</a> | <txp:email linktext=\"Contact the Admin\" email=\"forum_admin@example.com?subject=Comment&body=Write%20your%20comment%20here:%20%20\" />\r\n\r\n\t</div><!-- /txphorum_bottom_container -->\r\n\r\n</div><!-- /txphorum_master -->\r\n\r\n\r\n</body>\r\n</html>')";
		// forms: \" and \r\n returns and \t tabs
		// txphorum_discussion_form
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_discussion_form', 'article', '<txp:if_individual_article>\r\n\t\t\t\t\t\t\t<txp:asy_wondertag><txp:mem_form_secret name=\"txphorum_mem_Parent\" value=\"<txp:article_id />\" /></txp:asy_wondertag>\r\n\t\t\t\t\t\t<txp:else />\r\n\t\t\t\t\t\t\t<div class=\"label\">Title:&nbsp;</div>\r\n\t\t\t\t\t\t\t<div class=\"mem_input\"><txp:asy_wondertag><txp:mem_form_text label=\"\" name=\"txphorum_mem_Title\" break=\"\" class=\"mem_input\" /></txp:asy_wondertag></div>\r\n\t\t\t\t\t\t</txp:if_individual_article>\r\n\t\t\t\t\t\t\t<txp:asy_wondertag><txp:mem_form_secret name=\"txphorum_mem_Author\" value=\"<txp:ign_user_info type=\"name\" />\" /></txp:asy_wondertag>\r\n\r\n\t\t\t\t\t\t<div class=\"label\">Body:&nbsp;</div>\r\n\t\t\t\t\t\t<div><txp:asy_wondertag><txp:mem_form_textarea label=\"\" name=\"txphorum_mem_Body\" break=\"\" class=\"mem_input\" /></txp:asy_wondertag></div>\r\n\t\t\t\t\t\t<txp:output_form form=\"txphorum_textile_help\" />\r\n\r\n\t\t\t\t\t\t\t<div class=\"txphorum_submit\"><txp:mem_form_submit /></div>')";
		// txphorum_edit_form
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_edit_form', 'article', '<div id=\"txphorum_edit_container\">\r\n\r\n<div class=\"label\">Body:&nbsp;</div><div><txp:asy_wondertag><txp:mem_form_textarea label=\"\" name=\"txphorum_mem_Body\" default=\"<txp:txphorum_original_body />\" break=\"br\" class=\"txphorum_edit_textarea\" /></txp:asy_wondertag></div>\r\n\t\t<txp:output_form form=\"txphorum_textile_help\" />\r\n\t\t<div class=\"txphorum_submit\"><txp:mem_form_submit /></div>\r\n</div><!-- /txphorum_edit_container -->')";
		//txphorum_index
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_index', 'article', '<li><txp:permlink><txp:title /></txp:permlink> (Replies: <txp:comments_count />)</li>')";
		//login_form
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_login_form', 'article', '(u): <txp:ign_user_field /> (p): <txp:ign_pass_field /> <txp:ign_submit_field value=\"Login\" /> or <a href=\"<txp:bab_link name=\"txphorum_manage_register\" />\">Register</a>')";
		//post
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_post', 'article', '<txp:bab_if_gps check_for=\"edit\">\r\n\r\n\t<legend><a href=\"<txp:bab_link name=\"txphorum_index\" />\">Discussions</a> / Edit \"<txp:title />\"&nbsp;</legend>\r\n\t<txp:bab_if_author>\r\n\r\n\t\t<txp:asy_wondertag><txp:mem_form type=\"form\" redirect=\"<txp:bab_link name=\"txphorum_index\" />/<txp:bab_parent display=\"url_title\" />\" form=\"txphorum_edit_form\" /></txp:asy_wondertag>\r\n\r\n\t<txp:else />\r\n\t\t<p>You are not authorized.</p>\r\n\t</txp:bab_if_author>\r\n\r\n<txp:else /><!-- bab_if_gps -->\r\n\r\n\t<legend><a href=\"<txp:bab_link name=\"txphorum_index\" />\">Discussions</a> / \"<txp:title />\"&nbsp;</legend>\r\n\r\n\t<div id=\"txphorum_post_container\">\r\n\r\n\t\t<txp:if_section name=\"txphorum\">\r\n\t\t\t<div class=\"txphorum_author_posted\" ><txp:bab_author type=\"0\" /> / <txp:posted /></div>\r\n\t\t</txp:if_section>\r\n\r\n\t\t<div><txp:body /></div>\r\n\r\n\t\t<txp:if_section name=\"txphorum\">\r\n\t\t\t<div class=\"tagline\"><txp:bab_author type=\"1\" /></div>\r\n\t\t</txp:if_section>\r\n\r\n\t\t<txp:if_section name=\"txphorum\">\r\n\t\t\t<div class=\"txphorum_edit_report\"><txp:bab_if_author><a href=\"?edit=<txp:article_id />\">Edit</a> | </txp:bab_if_author><txp:asy_wondertag><txp:email linktext=\"Report\" email=\"moderation_request@example.com?subject=Moderation Request: <txp:article_id />&body=http://www.example.net/textpattern/index.php?event=list\" /></txp:asy_wondertag></div>\r\n\t\t</txp:if_section>\r\n\r\n\t</div><!-- /txphorum_post_container -->\r\n\r\n\t<txp:asy_wondertag><txp:article_custom custom1=\"<txp:article_id />\" form=\"txphorum_reply\" sort=\"Posted asc\" limit=\"1000\" /></txp:asy_wondertag>\r\n\r\n</txp:bab_if_gps>')";
		//reply
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_reply', 'article', '<div class=\"txphorum_reply_container\" >\r\n\r\n\t<div class=\"txphorum_author_posted\" ><txp:bab_author type=\"0\" /> / <txp:posted /></div>\r\n\t<div><txp:body /></div>\r\n\t<div class=\"tagline\"><txp:bab_author type=\"1\" /></div>\r\n\r\n\t<txp:if_section name=\"txphorum\">\r\n\t\t<div class=\"txphorum_edit_report\">\r\n\t\t\t<txp:bab_if_author>\r\n\t\t\t\t<a href=\"<txp:permlink />?edit=<txp:article_id />\">Edit</a> | \r\n\t\t\t</txp:bab_if_author>\r\n\t\t\t<txp:asy_wondertag><txp:email linktext=\"Report\" email=\"moderation_request@example.com?subject=Moderation Request: <txp:article_id />&body=http://www.example.net/textpattern/index.php?event=list\" /></txp:asy_wondertag>\r\n\t\t</div><!-- /txphorum_edit_report -->\r\n\t</txp:if_section>\r\n\t\r\n</div><!-- /txphorum_reply_container -->')";
		//self-reg
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_self_register_form', 'article', '<table><tr><td>Username (this cannot be changed):</td><td><txp:mem_form_text name=\"name\" label=\"\" break=\"\" /></td></tr><tr><td>Email: </td><td><txp:mem_form_email name=\"email\" label=\"\" break=\"\" /></td></tr><tr><td>Tagline (64 characters max): </td><td><txp:mem_form_text name=\"RealName\" label=\"\" break=\"\" /></td></tr><tr><td></td><td><txp:mem_form_submit /></td></tr></table>')";
		//textile_help
		$create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('txphorum_textile_help', 'article', '<div class=\"txphorum_textile_help\">*bold* | _italicize_ | \"link\":http://www.example.com | * bulleted list | !imageurl! | <a href=\"/txphorum_manage/help\">More</a></div>')";
		// articles
		//register
		$create_sql[] = "INSERT INTO `".PFX."textpattern` VALUES ('', now(), 'Forum Admin', now(), '', 'Register', '', 'Registering for the Forum offers several benefits, but is not required to participate in discussions. Current benefits include:\r\n\r\n* Edit your posts.\r\n* You can change your tagline and account email address at any time.\r\n\r\n<txp:mem_self_register_form form=\"txphorum_self_register_form\" />', 'Registering for the Forum offers several benefits, but is not required to participate in discussions. Current benefits include:\r\n\r\n* Edit your posts.\r\n* You can change your tagline and account email address at any time.\r\n\r\n<txp:mem_self_register_form form=\"txphorum_self_register_form\" />', '', '\n\n\n ', '', '', '', 1, 'Comment', 1, 4, 1, 1, 'txphorum_manage', '', '', 'register', '', '', '', '', '', '', '', '', '', '', 'babfea8fd42801204463b23701199f28', 0x323030352d30372d3333)";
		//profile
		$create_sql[] = "INSERT INTO `".PFX."textpattern` VALUES ('', now(), 'Forum Admin', now(), '', 'Profile', '', '<txp:ign_if_logged_in><txp:mem_self_user_edit_form><table><tr><td><b>Profile:</b><br /><br /></td><td></td></tr><tr><td>Username (cannot be changed):</td><td><txp:ign_user_info type=\"name\" /></td></tr><tr><td>Tagline (64 characters max.):</td><td><txp:mem_realname_input  label=\"\" class=\"mem_input tagline_input\" /></td></tr><tr><td>Email Address:</td><td><txp:mem_email_input  label=\"\" class=\"mem_input\" /></td></tr><tr><td></td><td><txp:mem_submit /></td></tr></txp:mem_self_user_edit_form><txp:mem_self_change_password_form><tr><td><b>Change your password:</b></td><td></td></tr><tr><td>New Password:</td><td><txp:mem_password_input label=\"\" /></td></tr><tr><td></td><td><txp:mem_submit /></td></tr></table></txp:mem_self_change_password_form><txp:else /><p>You aren\'t <a href=\"/txphorum_manage/register\">registered</a>!</p></txp:ign_if_logged_in>', '<txp:ign_if_logged_in><txp:mem_self_user_edit_form><table><tr><td><b>Profile:</b><br /><br /></td><td></td></tr><tr><td>Username (cannot be changed):</td><td><txp:ign_user_info type=\"name\" /></td></tr><tr><td>Tagline (64 characters max.):</td><td><txp:mem_realname_input  label=\"\" class=\"mem_input tagline_input\" /></td></tr><tr><td>Email Address:</td><td><txp:mem_email_input  label=\"\" class=\"mem_input\" /></td></tr><tr><td></td><td><txp:mem_submit /></td></tr></txp:mem_self_user_edit_form><txp:mem_self_change_password_form><tr><td><b>Change your password:</b></td><td></td></tr><tr><td>New Password:</td><td><txp:mem_password_input label=\"\" /></td></tr><tr><td></td><td><txp:mem_submit /></td></tr></table></txp:mem_self_change_password_form><txp:else /><p>You aren\'t <a href=\"/txphorum_manage/register\">registered</a>!</p></txp:ign_if_logged_in>', '', '\n\n\n ', '', '', '', 1, 'Comment', 1, 4, 1, 1, 'txphorum_manage', '', '', 'profile', '', '', '', '', '', '', '', '', '', '', 'bab2ea8fd42801204463b23701199f28', 0x323030352d30372d3334)";
		//guidelines
		$create_sql[] = "INSERT INTO `".PFX."textpattern` VALUES ('', now(), 'Forum Admin', now(), '', 'Guidelines', '', 'Coming soon!', '<p>Coming soon!</p>', '', '\n\n\n ', '', '', '', 1, 'Comment', 1, 4, 1, 1, 'txphorum_manage', '', '', 'guidelines', '', '', '', '', '', '', '', '', '', '', 'bab3ea8fd42801204463b23701199f28', 0x323030352d30372d3335)";
		//help
		$create_sql[] = "INSERT INTO `".PFX."textpattern` VALUES ('', now(), 'Forum Admin', now(), '', 'Help', '', 'Coming soon!', '<p>Coming soon!</p>', '', '\n\n\n ', '', '', '', 1, 'Comment', 1, 4, 1, 1, 'txphorum_manage', '', '', 'help', '', '', '', '', '', '', '', '', '', '', 'bab4ea8fd42801204463b23701199f28', 0x323030352d30372d3336)";
		// links
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum', 'txphorum_index', '', 'TXPhorum Index')";
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum_manage/register', 'txphorum_manage_register', '', 'TXPhorum Register')";
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum_manage/profile', 'txphorum_manage_profile', '', 'TXPhorum Profile')";
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum_manage/guidelines', 'txphorum_manage_guidelines', '', 'TXPhorum Guidelines')";
		$create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES ('', '2005-07-20 12:54:26', 'txphorum', '/txphorum_manage/help', 'txphorum_manage_help', '', 'TXPhorum Help')";
		// sections
		$create_sql[] = "INSERT INTO `".PFX."txp_section` VALUES ('txphorum', 'txphorum', 'txphorum', 0, 0, 0, 0, 'TXPhorum')";
		$create_sql[] = "INSERT INTO `".PFX."txp_section` VALUES ('txphorum_manage', 'txphorum', 'txphorum', 0, 0, 0, 0, 'TXPhorum Management')";
		$create_sql[] = "INSERT INTO `".PFX."txp_section` VALUES ('txphorum_replies', 'txphorum', 'txphorum', 0, 0, 0, 0, 'TXPhorum Replies')";	
		foreach ($create_sql as $query)
		{
			$result = mysql_query($query);
		} // end foreach
	} // end if gps
} // end if admin

How to make, that plugin automatically choose category, where article is added?
Example: I am in category: textpattern, then article adds to section: forums and category: textpattern.
I think, that it need edit in plugin code.

Last edited by elwins (2011-12-17 03:30:02)

Offline

Board footer

Powered by FluxBB