Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

danielmain on "Function to add user to post as author once registered"

$
0
0

Hello,

I am trying to find a function that I can add to my functions.php file to add a user to a post as an author once that user registers on my site. The only solution that I have found to this was to install a plugin such as Co-Authors Plus and then manually assign the user to the post as an author. I would do this, but the admin user will not be able to add the new user to the post at all times, and I cannot give the new user a level of permission to view any other posts. Thanks for any help!


Bnpositive on "Hide Post Edit Modules for User Role"

$
0
0

I'm trying to find a plugin, or how-to guide, for systematically hiding different modules from the post edit window for the user role of "Contributors".

For example. Some plugins add additional modules to the display like WordPress SEO by Yoast, that continue to display when I don't want that user role to see them.

I'd also like to restrict the Category option to allow this role to only select categories from a single parent category and its child categories. If I can't do that, then I'd like to hide the entire category module from view. Hide the "Slug" and "Author" and "Allow Comments" modules as well.

I've tried a variety of plugins, but none of them it appears does everything I need and some of them seem to be conflicting with each other.

Any help or guidance to a solution would be very much appreciated.

Bourke08 on "Best way to add pages that display individual user meta?"

$
0
0

Hello all,

I'm simply looking for some advice on what steps are required to make user bio pages.

It's for a networking group I'm in. I'm currently using WP-Members and Member List plugins.

WP-Members is what allows the members to log in on the front-end and manage their information. Member List created a directory that lists all our members on a particular page.

The problem is, that within the directory, you can't click on a company or person for a full-page of information.

What would be the best way to accomplish this? Plugin, Page Template, etc.

Any help is greatly appreciated.

orizayag on "WordPress Plugin needed, display and mannage ads like Facebook ads display"

$
0
0

hello everyone,
i just need u to tell me the plugin name ...

i need a plugin that let me upload ads to my blog that display like facebook ads: tiny image, text and sub text, and Monitor the amount of exposure and clicks of them...

if you can help me - please HELP

shazdeh on "media_handle_sideload kills the page without any errors"

$
0
0

This is a weird issue. I've made a little function to download an image from an external source and add it as an attachment. Here's the code:

function download_image_copy( $url, $desc = '' ) {
	require_once(ABSPATH . 'wp-admin/includes/file.php');
	require_once(ABSPATH . 'wp-admin/includes/media.php');

	$types = 'jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG';
	$file_array = array();

	$file_array['tmp_name'] = download_url( $url );
	if( is_wp_error( $file_array['tmp_name'] ) ) {
		@unlink( $file_array['tmp_name'] );
		return $url;
	}

	$pathparts = pathinfo( $file_array['tmp_name'] );
	$file_array['name'] = basename( $url );
	// fix file extension
	if( '' == $pathparts['extension'] || ! in_array( $pathparts['extension'], explode( '|', $types ) ) ) {
		$_file = $pathparts['dirname'] . DS . $file_array['name'];
		rename( $file_array['tmp_name'], $_file );
		$file_array['name'] = basename( $_file );
		$file_array['tmp_name'] = $_file;
	}

	$id = media_handle_sideload( $file_array, 1, $desc );
	echo 'Wow! We never reach this place!';

	if( is_wp_error( $id ) ) {
		@unlink( $file_array['tmp_name'] );
		return $url;
	}

	$src = wp_get_attachment_url( $id );
	return $src;
}

// let's try it out
echo download_image_copy( 'http://dribbble.s3.amazonaws.com/users/81899/screenshots/1170460/untitled-1.png' );

Sidenote: Sorry for pasting this code here. I can't access PasteBin.

The page stops just after calling the media_handle_sideload function, it actually never reaches that echo statement in the next line. I have enabled the debug mode but it doesn't display any errors.
That "fix file extension" block in the code was added because for me the download_url returns any file with an extension of "tmp" and so media_handle_sideload function was throwing "wrong media type" error. I have inspected the $file_array var and the path to the file and it's name are correct and exists on my filesystem.

Thanks for shedding any light on this.

jeffvand on "Code to Write to Wp-config.php"

$
0
0

I would like to be write some code to add a line to my wp-config.php file automatically.

Background:
I have about 100 sites that have no revision limitations on them. I would like to use ManageWP to just send over a code to add the following to my wp-config.php file (kind of like Super cache does when it is activated).

/*Optimization Stuff */
define('AUTOSAVE_INTERVAL', 120 );  // seconds (default is 60)
define('WP_POST_REVISIONS', 5); // alter number of post revisions kept.

Does anyone know the php that would insert this code into the wp-config.php file? Thanks for any thoughts you have.

Cory.Nickerson on "Custom Login & WordPress Cookies"

$
0
0

I'm making my own custom login page and functions and just need to know how to write the data for the cookies. I did var_dump($_COOKIE) and came up with this info which is stored in cookies.

array(4) {
	["wordpress_test_cookie"] => string(15) "WP Cookie check"
	["wordpress_logged_in_26136172b2949242d677f08fc280dbe6"]=> string(49) "Admin|1375480283|95c9b58b40883cb2b196138f1e45a8d9"
	["wp-settings-time-1"]=> string(10) "1374790168"
	["PHPSESSID"]=> string(26) "bbq3v8s3gk0qtsiggdf0j3q362"
}

What does each one do and how are they created?

Thanks

jhawkinssbcos on "Copying Widget From One Theme Inserting Into Another"

$
0
0

I purchased a theme which has a great widget. I want to take that widget and place it into another theme. How? Thanks!


Marcelo Pedra on "How can I download plugins from an installed WP to do partial backups"

$
0
0

Hi! I'm in a hurry with this situation. I have to redesign one wordpress site where the owners are not willing to give access to the FTP. That said, I need to reinstall several plugins and extract other paid plugins for this people without having to delete anyone, because the owners are not sure if they have backups of these paid plugins.

So, is there any way to backup only a couple of plugin folders without having access to FTP?

Thanks!

iddeo on "Dynamic menu´s items` names"

$
0
0

Hi evereyone!

I´m using worpress in a way that some users need to change pages´ content but being in Editor´s role (and it´s not possible to upgrade this role for them). That role doesn´t allow to change menu´s items´names and what they need is that when they change a page´s name, linked menu´s item changes names automatically too to match new page´s name.

It´s that possible?

Thanks in advance!

Cory.Nickerson on "Hasing User Passwords"

$
0
0

Working on a custom login page. I need to know how to hash the submitted password via the login form to match the password in the database.

$user_password = wp_hash_password( $_POST['user_password'] );

echo $user_password

This doesn't work. The output string for $user_password varies every time the form is submitted.

Ayman on "Passing xml file and skip the first screen on WordPress Importer"

$
0
0

Hi,

I'm creating a plugin that is downloading xml file from a remote server to the "local server", but the next step is to pass that downloaded file to WordPress Importer plugin and make the importer process it with out asking to upload a file to import so basicly passing the file to the uploader/importer and skipping the first screen.

Any suggestions or Ideas?

webcabbie on "I need lists of countries/cities for categories you got?"

$
0
0

There is no way someone does not have this

List 1
Continents
Child List 2
Countries
Child list 3
Cities

Making a directory. Someone has to have this.

nickniebaum on "Wierd AJAX/session issue - sessions being emptied on ajax call"

$
0
0

Hello,

I have a WP site I am working on that uses AJAX calls to load some view data based on some session data that is set. The problem is, the session data that is set is being emptied after an AJAX call. For example:

  • A user logs in, and session data is set to identify that user
  • The user goes to a dashboard, where he clicks a link which initiates an AJAX call that loads HTML based on that user's ID (which is in the session)
  • The loaded HTML is incorrect because the session data is emptied before the AJAX function is ran
  • Thereafter, if you reload the page you are on, the session data is emptied here as well, so the user will have to log in again, where he will again get logged out if he initiates the AJAX call

You may at first think it's a code issue, but I think not. I developed the site on my local machine running Apache, and everything worked fine. However, after uploading it to a Hostgator subdomain, I started getting this problem.

I've set up a barebones test case for anyone who might know what my problem is, which I'm wanting to say it's some kind of hosting configuration problem of some sort, although I'm not entirely sure, as I've never run into this before. The URL for the test case is at: http://accidentreview.lifthousedesign.com/test-page

This page is a blank page, with a single shortcode (PHP source further down in this post) in the body of the page. It simply empties the session, var_dumps it, then adds data to the session, var_dumps it, then displays a button that initiates an AJAX call. The AJAX call simply var_dumps the session (which will be empty because of this issue, whatever the problem is). Another button is below it, which reloads the page without emptying/adding anything to the session, to illustrate that the AJAX call empties the current session (it overwrites it with the empty session).

Shortcode Source:

<?php
	add_shortcode('session_test','session_test');

	function session_test()
	{
		if(!isset($_GET['dont_set']))
		{
			session_unset();
			echo 'session cleared:';
			var_dump($_SESSION);
			echo '<br />';
			$_SESSION['var_1']='val_1';
			$_SESSION['var_2']='val_2';
			$_SESSION['var_3']=array('arr_val_1','arr_val_2');
			echo 'added values to session:';
			var_dump($_SESSION);
			echo '<br />';
			echo 'session id:';
			var_dump(session_id());
			echo '<br />';
			?>
			<button id="test-session">Send AJAX Call (see console)</button>
			<br />
			<button id="reload-dont-set">Load Page without Setting/Emptying Session</button>
			<script>
				function test_session()
				{
					$.ajax({
						url: '/wp-admin/admin-ajax.php',
						data: {
							action: 'test-fn',
						},
						success: function(data){
							console.log('ajax data:');
							console.log(data);
						}
					});
				}

				function reload_dont_set()
				{
					window.location='/test-page?dont_set';
				}

				$(function(){
					$('#test-session').click(test_session);
					$('#reload-dont-set').click(reload_dont_set);
				});
			</script>
			<?
		}
		else
		{
			echo 'only dumping session (not clearing or setting anything):';
			var_dump($_SESSION);
		}
	}

AJAX source:

<?php
add_action('wp_ajax_test-fn','casea');
add_action('wp_ajax_nopriv_test-fn','caseb');

function casea()
{
	echo 'priv:';
	var_dump($_SESSION);
	echo 'session id:';
	var_dump(session_id());
}

function caseb()
{
	echo 'no priv:';
	var_dump($_SESSION);
	echo 'session id:';
	var_dump(session_id());
}

Anyway, thanks for taking the time to read and please let me know if ya'll can come up with anything I am missing!

calandry on "Jetpack Subscription Styling"

$
0
0

I am trying to change the jetpack subscription style to match my theme and have been unable to do so. I know nothing of PHP and I'm still learning CSS. I've tried using this format found on another thread, but haven't been able to get it to work as of yet.

.jetpack_subscription_widget input[type="submit"] {
/* Your CSS changes */
}

I want the button to be the color #EA141F
with the word submit appearing #fff
and a hover color of #364956

my site is http://columbusgabuzz.com I am using a child theme and trying to add the changes in the style sheet of the child theme.


pal8 on "Wordpress and basic Pagination"

$
0
0

What is the most basic pagination solution for WP? Showing default posts and using search results.

I've been looking around and found a lot of custom solutions but there must be a core WP solutions on such a basic issue like pagination. Right?

I get it to work with normal listing but not search.

senseloss on "Is there a plugin to make my blog private for facebook friends only?"

$
0
0

I want to have a wordpress blog that is completely private which requires login to view it, uses facebook to login, and only allows my facebook friends (even after login) to view the content.

I've tried searching google and the plugins area, I can find plenty of things to interconnect with facebook, but nothing to make the blog private to facebook friends only.

Any recommendations?

Thanks.

sfinxbookcenter on "how to customize search results ?"

ajmcfadyen on "Custom Post Types Have No TinyMCE Editor"

$
0
0

Hi Folks!

There are no content-editors on the custom post types of a site I am working on.

I'm hoping someone can shed some light on what could be causing this.

I have tried manually setting 'editor' => true on the post types.

I have tried removing everything from functions.php except the post types, disabling all plugins, and removing wp-alchemy.

I have tried adding a new custom post type after removing all plugins & functions.

The WordPress-core has not been edited.

Thanks in Advance!

curt2008 on "Add nextpage tag dynamically using Plugin Shortcode"

$
0
0

Hi Guys,

I'm trying to add the <!--nextpage--> tag dynamically using a Shortcode call, but all it's actually doing is adding it as an HTML Comment instead of rendering it as pagination links, here's my code that I'm attempting to do;

public function __construct() {
     add_shortcode('CONTINUED', array(&$this, 'continued_handle'));
}

public function continued_handle() {
    global $post;
    return $this->your_post_split($post);
}

public function your_post_split($content) {
    $output = '<div>In page 1</div>';
    $output .= '<!--nextpage-->';
    $output .= '<div>In page 2</div>';
    return $output;
}

If anyone can give me any advice as to how I can get it to render the <!--nextpage--> tag as Pagination links I'd be highly appreciated!

Viewing all 8245 articles
Browse latest View live




Latest Images