Forum Replies Created

Viewing 15 replies - 1 through 15 (of 27 total)
  • I second this question! Can’t find anything in the standard registration/profile pages on this. Maybe this is some type of scripting hook to tap into? Could really use this feature! =)

    Forum: Plugins
    In reply to: Auto Populate Posts
    Thread Starter skipcollege

    (@skipcollege)

    Hi seolun4tic,

    Thanks for the complements on my Auto Populate Posts hack!

    If I’m understanding your need correctly, it is a bit different than mine…

    Where mine is a form to optionally be used in real-time whenever adding a new post. Could be applied to the Add New Page form too.

    However, it sounds like you want to have one standard page created only one time, upon each new user signup. If so, then this would first mean adding code to insert the standard page into the database behind the scenes whenever anyone signs up.

    Then it also sounds like you want some type of form template that users can systematically fill out to edit that page after they signup. At this point, you could use my auto populate form method, but rather put it in the Edit Page form (I believe within wp-admin/edit-page-form.php) and insert a condition where this form template only shows itself when editing this one standard page you want to achieve it with.

    If I got that right, I could see where that would be useful in a lot of scenarios. However, I don’t have the skill to implement this for you, but it shouldn’t be too hard for an experienced php/mysql developer.

    If you create this in the future, feel free to post a link to it back here, as I would be interested.

    Thanks!

    Forum: Plugins
    In reply to: Auto Populate Posts
    Thread Starter skipcollege

    (@skipcollege)

    Hello everyone,

    Here is what I call my “Auto Populate Posts” wordpress hack that allows you to click buttons on the Add New Post page of the WordPress Admin and have predetermined content auto fill into either the Title, Content, and/or Excerpt fields of a new post.

    Please view the original support thread (www.ads-software.com/support/topic/308554) for my purpose of needing this functionality, which in short was to create templates for post fields if specific types of posts I regularly publish within WordPress without having to copy & paste from a text file.

    This shall be considered version 1.0 of this Auto Populate Posts hack.

    If anyone would like to cleanup or further develop this hack (especially into a plugin), and post the updates here, then that would be great!

    I am not skilled in coding, so this is a rough and non-elegant implementation, however, the basic functionality works properly.

    This Auto Populate Post hack was developed for WordPress version 2.8.4 on a LAMP (linux, apache, mysql, php) platform and also utilizes javascript.

    This hack is not supported, is highly experimental, and all risk & liability lies solely with the individual users of this code.

    ————————–

    Installation Instructions (4 Steps):

    – Step #1: Copy the following piece of code and paste it into the /wp-admin/edit-form-advanced.php core WordPress file…paste it between the following two lines at line #596 as of WP 2.8.4…

    <div id=”post-body-content”>
    PASTE CODE HERE
    <div id=”titlediv”>

    <!-- Auto Populate Posts Hack 1.0 -->
    <?php $autopopulatepostsfile = get_template_directory()."/autopopulateposts.php";
    	if(!file_exists($autopopulatepostsfile))
    	{ echo("<p style='font-weight:bold; color:#C00; margin-bottom:20px;'>The file named 'autopopulateposts.php' was not found in your currently active WP theme named '".get_current_theme()."'. Please uninstall this Auto Populate Posts hack or upload the 'autopopulateposts.php' file to this current theme's root directory at '".get_template_directory()."'.<br /><br /><span style='margin-left:20px; display:inline-block;'>- To uninstall this Auto Populate Posts hack, remove code between the <-- Auto Populate Posts Hack --> tags in core file '/wp-admin/edit-form-advanced.php' around line 596.</span><br /><br /><span style='margin-left:20px; display:inline-block;'>- For more info about this hack see: <a href='https://bit.ly/AutoPopulatePosts' target='_blank'>bit.ly/AutoPopulatePosts</a></span><br /><br /><span style='margin-left:20px; display:inline-block;'>- This hack is not supported by the author. Created for WordPress version 2.8.4. The source code may be freely distributed without restriction. :)</span></p>"); }
    	else { include_once($autopopulatepostsfile); } ?>
    <!-- Auto Populate Posts Hack 1.0 -->

    – Step #2: Open a new text file (in a program such as Notepad), paste the following code into it and save the file as “autopopulateposts.php”. Edit the table of predetermined Title, Content, & Excerpt data in this file as you require.

    <!-- End Auto Populate Posts Hack 1.0 / bit.ly/AutoPopulatePosts / Created for WordPress version 2.8.4 / This hack is not supported by the author. / The source code may be freely distributed without restriction. :) -->
    
    <script type="text/javascript" type="text/javascript">
    //<![CDATA[
    if(document.createElement)
    (function(){
    var radiostitle = function(e){
    e = e || window.event;
    var t = e.target || e.srcElement, t2, c = 0;
    if (t.name == 'stitle'){
    t2 = t.parentNode;
    while (t2.nextSibling){
    t2 = t2.nextSibling;
    if (t2.firstChild && t2.firstChild.nodeValue)
    document.getElementById('title').value = t2.firstChild.nodeValue;
    }
    }
    };
    if (document.addEventListener)
    document.addEventListener('click', radiostitle, false);
    else if (document.attachEvent)
    document.attachEvent('onclick', radiostitle);
    })();
    //]]>
    </script>
    
    <script type="text/javascript" type="text/javascript">
    //<![CDATA[
    if(document.createElement)
    (function(){
    var radioscontent = function(e){
    e = e || window.event;
    var t = e.target || e.srcElement, t2, c = 0;
    if (t.name == 'scontent'){
    t2 = t.parentNode;
    while (t2.nextSibling){
    t2 = t2.nextSibling;
    if (t2.firstChild && t2.firstChild.nodeValue)
    document.getElementById('content').value = t2.firstChild.nodeValue;
    }
    }
    };
    if (document.addEventListener)
    document.addEventListener('click', radioscontent, false);
    else if (document.attachEvent)
    document.attachEvent('onclick', radioscontent);
    })();
    //]]>
    </script>
    
    <script type="text/javascript" type="text/javascript">
    //<![CDATA[
    if(document.createElement)
    (function(){
    var radiosexcerpt = function(e){
    e = e || window.event;
    var t = e.target || e.srcElement, t2, c = 0;
    if (t.name == 'sexcerpt'){
    t2 = t.parentNode;
    while (t2.nextSibling){
    t2 = t2.nextSibling;
    if (t2.firstChild && t2.firstChild.nodeValue)
    document.getElementById('excerpt').value = t2.firstChild.nodeValue;
    }
    }
    };
    if (document.addEventListener)
    document.addEventListener('click', radiosexcerpt, false);
    else if (document.attachEvent)
    document.attachEvent('onclick', radiosexcerpt);
    })();
    //]]>
    </script>
    
    <style type="text/css">
    	.app-autopopulateposts-items td {
    		border:1px solid #464646;
    		width:55px;
    		max-width:105px;
    		height:20px;
    		max-height:35px;
    		overflow:hidden;
    		white-space:nowrap;
    		padding-left:1px;
    		padding-right:1px;
    		}
    	.app-autopopulateposts-items td:hover {
    		width:100%px;
    		max-width:100%;
    		background-color:#FFC;
    		}
    </style>
    
    <div style="width:99%; background-color:#464646; padding:2px 1px 2px 1px; font-weight:bold; color:#fff;"><div style="text-align:left; float:left; width:45%; padding-left:7px;">Auto Populate Posts...</div><div style="text-align:right; float:right; width:45%; padding-right:7px;"><a href="https://bit.ly/AutoPopulatePosts" target="_blank" style="color:#fff; font-style:normal; font-size:10px;">Info Link</a></div><div style="clear:both; line-height:0px; height:0px;">&nbsp;</div></div>
    <div style="width:99%; max-height:170px; overflow:scroll; margin-bottom:20px; border:1px solid;">
    <table style="width:50%; padding:5px;">
    	<tr>
    		<td style="text-align:center; font-weight:bold; text-decoration:underline; font-size:14px;">Post Title</td>
    		<td style="text-align:center; font-weight:bold; text-decoration:underline; font-size:14px;">Post Content</td>
    		<td style="text-align:center; font-weight:bold; text-decoration:underline; font-size:14px;">Post Excerpt</td>
    	</tr>
    	<tr>
    		<td style="vertical-align:top; padding:0px 5px 0px 5px;">
    			<table class="app-autopopulateposts-items">
    				<tr>
    					<td><input name="stitle" type="radio"></td>
    					<td>EDIT: Post Title #1:</td>
    					<td>EDIT: This is title #1</td>
    				</tr>
    				<tr>
    					<td><input name="stitle" type="radio"></td>
    					<td>EDIT: Post Title #2:</td>
    					<td>EDIT: This is title #2</td>
    				</tr>
    				<tr>
    					<td><input name="stitle" type="radio"></td>
    					<td>EDIT: Post Title #3:</td>
    					<td>EDIT: This is title #3</td>
    				</tr>
    				<tr>
    					<td><input name="stitle" type="radio"></td>
    					<td>EDIT: Post Title #4:</td>
    					<td>EDIT: This is title #4</td>
    				</tr>
    				<tr>
    					<td><input name="stitle" type="radio"></td>
    					<td>EDIT: Post Title #5:</td>
    					<td>EDIT: This is title #5</td>
    				</tr>
    			</table>
    		</td>
    		<td style="vertical-align:top; padding:0px 5px 0px 5px;">
    			<table class="app-autopopulateposts-items">
    				<tr>
    					<td><input name="scontent" type="radio"></td>
    					<td>EDIT: Post Content #1:</td>
    					<td>EDIT: This is content #1</td>
    				</tr>
    				<tr>
    					<td><input name="scontent" type="radio"></td>
    					<td>EDIT: Post Content #2:</td>
    					<td>EDIT: This is content #2</td>
    				</tr>
    				<tr>
    					<td><input name="scontent" type="radio"></td>
    					<td>EDIT: Post Content #3:</td>
    					<td>EDIT: This is content #3</td>
    				</tr>
    				<tr>
    					<td><input name="scontent" type="radio"></td>
    					<td>EDIT: Post Content #4:</td>
    					<td>EDIT: This is content #4</td>
    				</tr>
    				<tr>
    					<td><input name="scontent" type="radio"></td>
    					<td>EDIT: Post Content #5:</td>
    					<td>EDIT: This is content #5</td>
    				</tr>
    			</table>
    		</td>
    		<td style="vertical-align:top; padding:0px 5px 0px 5px;">
    			<table class="app-autopopulateposts-items">
    				<tr>
    					<td><input name="sexcerpt" type="radio"></td>
    					<td>EDIT: Post Excerpt #1:</td>
    					<td>EDIT: This is excerpt #1</td>
    				</tr>
    				<tr>
    					<td><input name="sexcerpt" type="radio"></td>
    					<td>EDIT: Post Excerpt #2:</td>
    					<td>EDIT: This is excerpt #2</td>
    				</tr>
    				<tr>
    					<td><input name="sexcerpt" type="radio"></td>
    					<td>EDIT: Post Excerpt #3:</td>
    					<td>EDIT: This is excerpt #3</td>
    				</tr>
    				<tr>
    					<td><input name="sexcerpt" type="radio"></td>
    					<td>EDIT: Post Excerpt #4:</td>
    					<td>EDIT: This is excerpt #4</td>
    				</tr>
    				<tr>
    					<td><input name="sexcerpt" type="radio"></td>
    					<td>EDIT: Post Title #5:</td>
    					<td>EDIT: This is excerpt #5</td>
    				</tr>
    			</table>
    		</td>
    	</tr>
    </table>
    <div style="text-align:center; font-weight:bold; color:#C00; font-style:italic;">To edit your auto populate content, edit the autopopulateposts.php file.</div>
    </div>
    
    <!-- End Auto Populate Posts Hack 1.0 / bit.ly/AutoPopulatePosts / Created for WordPress version 2.8.4 / This hack is not supported by the author. / The source code may be freely distributed without restriction. :) -->

    – Step #3: Upload this newly edited “autopopulateposts.php” file to the root of your WordPress theme located at /wp-content/themes/YOURTHEMEDIRECTORY.

    – Step #4: Go to your WordPress Admin to the Add New Post form and a table of radio buttons should appear at the top of the left column of wide input fields (likely above your Title field). You should be able to click on the radio buttons in this table and have the Title, Content, & Excerpt fields auto fill with the predetermined content without having to type or paste it in.

    ————————–

    Current Bugs:
    – The form’s html table does not display nicely in Internet Explorer 8, however, it is still usable and the functionality works well. Firefox, Safari, & Chrome display properly.

    ————————–

    Future Plans:
    – I plan to add functionality to auto populate the Categories field in the future when I have more time to figure the right code out for auto checking multiple checkboxes with the click of a button, likely using javascript.

    ————————–

    If you have received some benefit from this Auto Populate Posts hack, would like to make a suggestion, or can improve upon it, then I’d enjoy hearing from you in this thread.

    Thank you! ??

    Thread Starter skipcollege

    (@skipcollege)

    I have posted my Auto Populate Posts hack source code to the following thread as a solution…

    https://www.ads-software.com/support/topic/308683

    Thanks! ??

    Thread Starter skipcollege

    (@skipcollege)

    Thanks for the kind offer Tom, however, I was able to find some general javascript code through a Google search and successfully hacked a working solution together.

    I will come back to post the working solution here today! ??

    Hello, I was wondering how you added .htm to your pages. I’m looking for that solution currently and can’t find a working hack.

    Any guidance you could give would be appreciated!

    Thanks

    Hello, I’m looking for this solution as well. Any luck in finding a working solution for this yet?

    Thanks

    Thread Starter skipcollege

    (@skipcollege)

    Hacked it myself. Here it is…

    In includes/feed-rss2-comments.php on line 49 I changed

    <?php comment_text(); ?>

    to

    <?php if (is_page(‘2’)) the_excerpt(); else comment_text(); ?>

    Use is_single for posts if you wish.

    Thread Starter skipcollege

    (@skipcollege)

    bump…I haven’t heard from anyone for over a month! I believe this just comes down to 1 line of simple code. (If this is WP Page and not Post…do my hack) Could someone take a shot at it for me please!?

    Thank you!

    Thread Starter skipcollege

    (@skipcollege)

    I need to solve this asap because the site is going live very soon.

    I believe I described the situation very clearly a few posts back here… https://www.ads-software.com/support/topic/75826?replies=19#post-476547

    I’ve been working on this for hours and haven’t been able to get the right php statement to check if it is a page.

    I’ve tried many variations of something like this…

    if ( $this->is_page = true ) { $req_uri = preg_replace(“|.html$|”, ”, $req_uri); }

    I’m assuming all it takes is a simple php if statement to apply this to only wordpress pages and not blog posts.

    If so then all I need is an if statement that works in includes/classes.php that checks if the current webpage being viewed is a wordpress page or post. Then I want to apply the functioning file extension hack that I have to only pages and not both pages and posts like it is now.

    If my assumptions are right this should be very easy for someone who knows php and is familiar with wordpress. I really need to solve this asap and could use some help.

    Thank you!

    Thread Starter skipcollege

    (@skipcollege)

    bump #4!

    Doesn’t this just take a simple if-then statement in the right place to apply this only to wordpress pages?

    Could someone possibly help me out?

    Thank you!! ??

    Thread Starter skipcollege

    (@skipcollege)

    bump #3!

    Doesn’t this just take a simple if-then statement in the right place to apply this only to wordpress pages?

    Thread Starter skipcollege

    (@skipcollege)

    bump #2!

    Thread Starter skipcollege

    (@skipcollege)

    bump #1!

    Thread Starter skipcollege

    (@skipcollege)

    I’m having a little conflict with this hack now and am so close to having it work right again in 2.0.5.

    I have $req_uri = preg_replace(“|.html$|”, ”, $req_uri); inserted after $req_uri = preg_replace(“|^$home_path|”, ”, $req_uri); on line 1522 of wp-includes/classes.php.

    My wordpress pages are accessible at domain.com/pagename.html and domain.com/pagename which is fine.

    The problem comes in when I try to access my blog posts at their individual permalink urls. All of the links throughout the site and feeds point to the correct location which is domain.com/2006/11/postname.html. However when I browse to an individual blog post url I get a 404 error. But when I add another .html to that url it works. So the page displays itself properly at domain.com/2006/11/postname.html.html.

    So the hack is correctly making pages accessible with the .html extension added on but it is adding an extra .html onto the url of blog posts.

    It seems like this could be solved by adding some simple php logic to make the .html extension be applied to only wordpress pages.

    I attempted to do this by changing the original hack code, that I mentioned above, into this…

    if ( $this->is_page = true ) { $req_uri = preg_replace(“|.html$|”, ”, $req_uri); }

    It did not work. Would someone know how to make this adding of the file extension only apply to pages and not posts?

    Thank you!

Viewing 15 replies - 1 through 15 (of 27 total)