php

  1. K

    Passing JavaScript to Session variable

    I am trying to pass a variable to a php session variable, so I can access it later from other functions. I might have a totally approach, I'm not sure. What I want to do is to have my vaiable stored somewhere so I can access it anytime and anywhere within a session. This is what I have now...
  2. R

    Laravel Sorting user collection based by distance

    public function nearby() { $user = auth()->user(); $lat = auth()->user()->latitude; $lon = auth()->user()->longitude; $radius = 3; // km => converted to meter $angle_radius = (float)$radius / ( 111 * cos( (float)$lat ) ); // Every lat|lon degree° is ~ 111Km $min_lat =...
  3. S

    Upgrading to PHP 7.1

    I have a quick question about upgrading my theme file to PHP 7.1. I know it's easy to do, but I don't understand PHP. It is currently in an old compatibility of 5.3 and this is the only error in 2 parts of my theme: "ERROR | Using a call-time pass-by-reference is deprecated since PHP 5.3 and...
  4. E

    Send variable to PHP file

    In a WordPress post I'm trying to send data to a PHP file stored in the root folder of my website with this code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"> console.log('hi'); var cen = document.getElementById("centro").value; $.ajax({...
  5. S

    WordPress pages specified Menu

    Dears, I need to customize pages in header and footer so I write `<?php $args = array('theam_location' => 'Primary'); ?> <?php wp_nav_menu( $args ); ?>` in header And write `<?php $args = array('theam_location' => 'Footer' ); ?> <?php wp_nav_menu( $args ); ?>` in footer And in...
  6. R

    Wordpress: how to hook get_the_post_thumbnail_url() function

    I'm new to Wordpress. What I am trying to do is to hook the get_the_post_thumbnail_url() and return slightly different URL. I know that I can use WP add_action() for hooking. If I write my function and return required string how can I make sure that the get_the_post_thumbnail_url() will return...
  7. H

    Returning the Post Slug

    Is it possible for me return the Post Url attached to a custom taxonomy on WordPress? I have done something like this. $taxonomy = 'series'; $tax_terms = get_terms( $taxonomy, $args ); print_r($tax_terms); how ever this only returns the following. [0] => WP_Term Object ( [term_id] => 7447...
  8. S

    Wordpress search results in columns

    I'm trying to style my Wordpress search results so that they appear in columns (3 columns per row) but somehow it's not working. Maybe you can help me? I've googled this problem and tried placing the while loop inside the row div but that wouldn't work. The site is: www.medical-promotion.de...
  9. P

    How to fix navigation bar in wordpress?

    I am working on a theme which has a dynamic menu when we scroll it goes hide. I want to fix it on the top just like w3school website. Any idea? Is it a good option to use a plugin like Sticky menu Here is the website link https://spaceunlimited.in/ CSS .ehf-header #masthead { z-index: 30...
  10. T

    I get a empty result in select2 with php “select(sql)”

    I want to search with select 2 in page wordpress and i want to get in result only private page, I get a number of li correct "14 li" and this what i have in my db but li foreach is empty why? $post_id = $wpdb->get_results("SELECT `ID`,`post_title` FROM $wpdb->posts WHERE `post_type` = 'page'...
  11. W

    Move related product to the sidebar on Woocommerce single products

    In woocommerce product page, i would like remove the related product on the product bottom page and put it on sidebar. I can remove it (on the bottom) with: remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); and add it in sidebar a widget...
  12. N

    Replace symbol .= php

    hello i have this code: $thread_qry5= "SELECT * FROM xenProve_prove ORDER BY view_count DESC LIMIT 5"; $row5 = XenForo_Application::get('db')->fetchAll($thread_qry5); foreach ( $row5 AS $rows5 ) {...
  13. K

    Phalcon and XenForo

    I'm trying to add XenForo to my Phalcon application. The project is structured like this: www/ phalcon/ app/ controllers/ AccountController.php views/ account login.phtml public/ forums/...
  14. J

    How do I update latest_tagged_content in xf_tinhte_xentag_tag row?

    I've created a XenForo thread and post which have been created in db and serialized tag is in the thread, but the tag row is not updated to include the latest_tagged_content. What is the best way to update the tag row with new thread/post? $writer =...
  15. D

    How to correctly initialise XenForo environment and create a user?

    I am trying to create a new XenForo user in PHP. I am using this example code: $newusername = "Joseph"; $newpassword = "12345"; $newemail = "joseph@yahoo.com"; $fileDir = "/home/myfullpath/public_html/members/xenforo"; require( $fileDir . '/library/XenForo/Autoloader.php')...
  16. B

    setcookie() from localhost for other local site with domain name

    I have two site on my Linux installation : theming.dev xenforo.dev On theming.dev, inside my code, I have : setcookie("mycookiename", "cookievalue", time()+3600, "", "xenforo.dev"); But when I going on my local website called xenforo.dev, I don't have the cookie called "mycookiename", Why...
  17. J

    How to get checkboxes to repopulate using xenforo options

    Im using the following function in XenForo and the checkboxes are created for each node and the chosen options are saved in the db, but when the option is reloaded, the saved values are not being repopulated in the form. Option: <option option_id="hc_watched_forums_list" edit_format="callback"...
  18. A

    SimpleXML can't get CDATA with ns prefixes

    My dilemma has to do with retrieving thread data through xenForo's RSS feeds. Here is a sample of the RSS data I'm trying to retrieve, everything works fine except for retrieving the <content:encoded>. Sample file: <?xml version="1.0" encoding="utf-8"?> <rss version="2.0"...
  19. N

    XenAPI - How to convert API response to PHP Variable

    I am a newbie on PHP programming, currently i trying to integrate a Xenforo forum with my website. I would like to integrate the registration system use XenAPI plugin. I follow the guide from this page and it works! Example request...
  20. B

    Evaluating array content (PHP, XenForo)

    I'm having few troubles when evaluating an array data to filter some content. I'm sending to the template an array with few numbers (1,4,5,10,12,14,20 - for example) and then i want to filter if it has a specific value. Let's say i want to know if it has '2' as a single value. What would be the...
Top