Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Just One Reply Blockquote per Reply
Avatar
sintmacro
Member
Free Members
sp_UserOfflineSmall Offline
May 11, 2013 - 4:10 pm

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.

 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 11, 2013 - 6:05 pm

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
Member
Free Members
sp_UserOfflineSmall Offline
May 11, 2013 - 6:34 pm

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
SP Master
Free Members
sp_UserOfflineSmall Offline
May 11, 2013 - 6:59 pm

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

Avatar
sintmacro
Member
Free Members
sp_UserOfflineSmall Offline
May 11, 2013 - 7:10 pm

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
SP Master
Free Members
sp_UserOfflineSmall Offline
May 11, 2013 - 8:11 pm

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
Member
Free Members
sp_UserOfflineSmall Offline
May 12, 2013 - 4:22 am

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
SP Master
Free Members
sp_UserOfflineSmall Offline
May 12, 2013 - 12:22 pm

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
Member
Free Members
sp_UserOfflineSmall Offline
May 12, 2013 - 2:23 pm

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
SP Master
Free Members
sp_UserOfflineSmall Offline
May 12, 2013 - 8:26 pm

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

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625