A A A
Forum Scope


Match



Forum Options



Min search length: 3 characters / Max search length: 84 characters
Forum Login
Lost password?
general-topic
Just One Reply Blockquote per Reply
RSS
Avatar
sintmacro
25 Posts
(Offline)
1
May 11, 2013 - 4:10 pm
Print

Hi,

One my old forum (version 4.45) I had changed (with help) the reply with just one blockquote added. See the example how it was on the old forum:

blockquote-old.pngImage Enlarger

 

And below a sample on the new version now: 

blockquote-new.pngImage Enlarger

 

Change of code was done at the file sf-forum.js. See the code how we changed it. 

Code OLD forum:
 
function sfjquotePost(postid, intro, editor, forumid, quoteUrl)
{
quoteUrl+=’&post=’+postid+’&editor=’+editor+’&forumid=’+forumid;
 
jQuery(‘#sfpostform’).show(function() {
jQuery(‘#postitem’).load(quoteUrl, function(content, b) {
 
 
//——————–
// Added 2010-08-13 by Arno Brinkman
//
// First remove/replace some horizontal breaks and whitspace
content=content.replace(/(<\/blockquote>)(\s*)(((<p>\s*<\/p>)\s*(<hr\s*\/>))|((<hr\s*\/>)\s*(<p>\s*<\/p>)))/ig, ‘</blockquote>’);
 
 
/* all browsers */
document.getElementById(‘sfpostform’).scrollIntoView();
 
if(editor == 2 || editor == 4)
{
//——————–
// Added 2010-08-15 by Arno Brinkman
//
// Remove quote blocks
content=content.replace(/(<div>((.|\n|\r)*)<\/code>)((.|\n|\r)*)(<blockquote>((.|\n|\r)*)<\/blockquote>)/ig, ”);
//
//——————–
 
document.addpost.postitem.value = ‘<div><strong>’+intro+'</strong></div>\r\r’+'<blockquote>’+content+'</blockquote><hr />\r\r’;
document.addpost.postitem.focus();
}
if(editor == 3)
{
document.addpost.postitem.value = ‘‘+intro+’\r\r

‘+content+’

\r\r’;

document.addpost.postitem.focus();
}
if(editor == 1)
{
 
//——————–
// Added 2010-08-15 by Arno Brinkman
//
// Remove quote blocks
//content=content.replace(/(<p><strong>((.|\n|\r)*)<\/strong><\/p>)((.|\n|\r)*)(<blockquote>((.|\n|\r)*)<\/blockquote>)/ig, ”);
content=content.replace(/(<div>((.|\n|\r)*)<\/div>)((.|\n|\r)*)(<blockquote>((.|\n|\r)*)<\/blockquote>)/ig, ”);
//
//——————–
 
if(jQuery.browser.mozilla || jQuery.browser.opera)
{
tinyMCE.activeEditor.selection.setContent(‘<div><strong>’+intro+'</strong></div><blockquote>’+content+'</blockquote><p><hr /><br /></p>’);
tinyMCE.activeEditor.focus();
}
if(jQuery.browser.safari || jQuery.browser.webkit)
{
tinyMCE.activeEditor.execCommand(“InsertHTML”, false, ‘<div><strong>’+intro+'</strong></div><blockquote>’+content+'</blockquote><p><hr /><br /></p>’);
}
 
if(jQuery.browser.msie)
{
tinyMCE.activeEditor.execCommand(“mceInsertRawHTML”, false, ‘<div><strong>’+intro+'</strong></div><blockquote>’+content+'</blockquote><p><hr /></p>’);
tinyMCE.activeEditor.focus();
}
}
});
});
}
 
 
Now the code is like below. 
 
New forum code:
 
function spjQuotePost(postid, intro, forumid, quoteUrl) {
quoteUrl+=’&post=’+postid+’&forumid=’+forumid;
 
jQuery(‘#spPostForm’).show(‘normal’, function() {
        spjOpenEditor(‘spPostForm’, ‘post’);
jQuery(‘#postitem’).load(quoteUrl, function(content, b) {
spjEdInsertContent(intro, content);
});
});
}

 

I tried to change it but it doesn’t work. Hopefully you can help me with this.

 

Attachments
Avatar
Mr Papa
Simi Valley, CA

19448 Posts
(Offline)
2
May 11, 2013 - 6:05 pm
Print

first, what are you trying to do?  I dont understand the relationship of the first image to the second image???

are you just wanting a single blockquote in the post content?  just filter the post content and remove… probably using the same regex you used before…

something link:

add_filter('sph_save_post_content_filter', 'my_content_filter');
function my_content_filter($content) {
# do your blockquote regex or other code to change multi blockquote
}

stick that in the spFunctions.php file of your theme…

in 5.0, you wont need to be editing core code to customize…  extensive theme work and api of hooks, filters and actions…

Avatar
sintmacro
25 Posts
(Offline)
3
May 11, 2013 - 6:34 pm
Print

Hi, both images are form different forums. The first one is how it is now at the old version (4.45) en de second one how it is at my testsite. What happens is if someone add a reply and another one quote this, then it will get one blockquote with the text of the quoted post. But if someone else quote on this message you’ll get 2 blockquotes with all the text. That’s how it standard works. On my old forum it was changed by the code and add just the latest reply on the post in the blockquote. Hopes this makes it a bit more clear.

Thanks.

Avatar
Mr Papa
Simi Valley, CA

19448 Posts
(Offline)
4
May 11, 2013 - 6:59 pm
Print

my answer still stands…  just filter the post content with the hook I showed you…

Avatar
sintmacro
25 Posts
(Offline)
5
May 11, 2013 - 7:10 pm
Print

OKe thanks. But the thing is that I don’t know what part of the code I need to add. The code was created by some one else and unfortunatelly I don’t have the knowledge to change it. Hopefully you’ll assist me with this?

Thanks in advance.

Avatar
Mr Papa
Simi Valley, CA

19448 Posts
(Offline)
6
May 11, 2013 - 8:11 pm
Print

afraid I dont know what they did either… would have to spend bunch of time studying it…

you will want a regex to replace all occurrences of blockquote with a div except for the first (negative lookahead?)…  If I get some time, I will think on it…

Avatar
sintmacro
25 Posts
(Offline)
7
May 12, 2013 - 4:22 am
Print

OKe thanks anyway. I’ll have some tries by myself eather. If it works I’ll let you know. Maybe it’s something for a  future version.

Avatar
Mr Papa
Simi Valley, CA

19448 Posts
(Offline)
8
May 12, 2013 - 12:22 pm
Print

here is one that strips all blockquote

$out = preg_replace(“~<blockquote(.*?)>(.*)</blockquote>~si”,””,’ ‘.$out.’ ‘);

would need to add a negative lookahead to skip the first one…

Avatar
sintmacro
25 Posts
(Offline)
9
May 12, 2013 - 2:23 pm
Print

Mr Papa said
here is one that strips all blockquote

$out = preg_replace(“~<blockquote(.*?)>(.*)</blockquote>~si”,””,’ ‘.$out.’ ‘);

would need to add a negative lookahead to skip the first one…

 

Thanks. I would prefer to keep the blockquote only from the first quoted post. Quote button would be unnecessary.

Avatar
Mr Papa
Simi Valley, CA

19448 Posts
(Offline)
10
May 12, 2013 - 8:26 pm
Print

Yes, I know… why I said that quick piece of code wouldnt do it…

Forum Timezone: America/New_York
All RSS Show Stats
Administrators: Blues Dancer, Simple Press, SP Community Support
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 629
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Newest Members:
Andy Cenoz
Kundan Dheevar
Wally Harvey
n1 n2
James Schwinn
Jaroslaw Balczewski
Lu Hunter
Jocelyne McGeever
Matthew Wolze
Forum Stats:
Groups: 7
Forums: 17
Topics: 10053
Posts: 79333

 

Member Stats:
Guest Posters: 606
Members: 16890
Moderators: 0
Admins: 3

Most Users Ever Online
499
Currently Online
Guest(s)
9
Currently Browsing this Page

1 Guest(s)