![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Raise Your Weapon
Industry Role:
Join Date: Jun 2003
Location: Outback Australia
Posts: 15,601
|
![]() Is it possible for a plugin to capture the text of a post someone has just entered in their posts area then perform an operation on that text before it gets placed into the database ?
Examples, taking the text and adding or removing elements, taking the text and adding or removing particular words or phrases ? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Nov 2009
Posts: 1,425
|
Pretty much anything on the web is possible if you have programming skills and unlimited time.
With that being said... Good Luck! ![]()
__________________
Go Fuck Yourself! ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
Sure, you can hook into the save_post action.
http://codex.wordpress.org/Plugin_AP...ence/save_post For a list of tons of other hooks: http://codex.wordpress.org/Plugin_API/Action_Reference
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Raise Your Weapon
Industry Role:
Join Date: Jun 2003
Location: Outback Australia
Posts: 15,601
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
Hmm, content_save_pre might be closer to what you need according to this:
http://wordpress.stackexchange.com/q...-prior-to-save WordPress StackExchange has filled out really well with a lot of great information about customizing WP.
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
So Fucking Banned
Industry Role:
Join Date: Nov 2011
Posts: 1,540
|
yup, its possible.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Beer Money Baron
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
|
The latest forum idiot? Easy enough to ignore.
https://gfy.com/profile.php?do=addlis...gnore&u=162926
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Raise Your Weapon
Industry Role:
Join Date: Jun 2003
Location: Outback Australia
Posts: 15,601
|
Quote:
http://wordpress.stackexchange.com/q...re-it-is-saved I'm well on the way now. I hardly ever write any plugins myself but I just needed to whip something up for testing an idea real quick thanks for the responses |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
So fuckin' bored
Industry Role:
Join Date: Jun 2003
Posts: 32,384
|
![]() Quote:
__________________
Obey the Cowgod |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Too old to care
Industry Role:
Join Date: Jun 2001
Location: On the sofa, watching TV or doing my jigsaws.
Posts: 52,943
|
Now you can add this info to your blog to teach newbies. LOL
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | ||
Raise Your Weapon
Industry Role:
Join Date: Jun 2003
Location: Outback Australia
Posts: 15,601
|
Quote:
Quote:
![]() |
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 | |
Femcams.com
Industry Role:
Join Date: Jul 2011
Location: bjcam.com
Posts: 12,221
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 55,359
|
you want wp_insert_post_data
i did this, so when you publish a post it took you back a year ;) Code:
function back_to_the_future($data,$postarr) { $format = 'Y-m-d H:i:s'; $old_date = $data['post_date']; $old_date_gmt = $data['post_date_gmt']; $new_date = date($format, strtotime('-1 year',strtotime($old_date))); $new_date_gmt = date( $format, strtotime('-1 year',strtotime($old_date_gmt))); $data['post_date'] = $new_date; $data['post_date_gmt'] = $new_date_gmt; return $data; } add_filter('wp_insert_post_data','back_to_the_future',99,2); like so Code:
function change_post_content($data,$postarr) { $post_content = strip_tags($data['post_content']); $data['post_post_content'] = $post_content; return $data; } add_filter('wp_insert_post_data','change_post_content',99,2); this will get you started.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. ![]() WP Stuff |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Raise Your Weapon
Industry Role:
Join Date: Jun 2003
Location: Outback Australia
Posts: 15,601
|
Hey, thanks heaps for that fris.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Raise Your Weapon
Industry Role:
Join Date: Jun 2003
Location: Outback Australia
Posts: 15,601
|
Just for anyone else who is interested in the solution here, based on fris' excellent example this is changing the post content, you could replace ucwords with any function or series of functions to modify your post content.
Code:
<?php /* Plugin Name: Your own Plugin Plugin URI: http://someurl.com Description: Converts the fist letter of every word to upper case. Author: Your Name Version: 1.5 */ function change_content($data,$postarr) { $old_content = $data['post_content']; $new_content = ucwords($old_content); $data['post_content'] = $new_content; return $data; } add_filter('wp_insert_post_data','change_content',99,2); ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |