Friday, August 11, 2017

Event Tickets Plus: csv export of All the Events in the Site.

Recently i have come across a requirement to generate a csv report which contains all the event Attendee details in it.


$testing = tribe_get_events ();
$AllEventAttendeesExport= Array();
$titleFields = array();
foreach ($testing as $keysas => $valueas) {
$fields = array();
$fields = Tribe__Tickets_Plus__Main::instance()->meta()->get_meta_fields_by_event( $valueas->ID  );
$AllEventAttendeesExport[$valueas->ID]['titles'][] =  'Event Ticket';
$AllEventAttendeesExport[$valueas->ID]['titles'][] =  'Primary-Information';
$AllEventAttendeesExport[$valueas->ID]['titles'][] =  'Security Code';
$AllEventAttendeesExport[$valueas->ID]['titles'][] =  'Check in';
foreach ($fields as $keyfields => $valuefields) {
$AllEventAttendeesExport[$valueas->ID]['titles'][] = $valuefields->label;
}
$items = Tribe__Tickets__Tickets::get_event_attendees( $valueas->ID  );
foreach ($items as $keyI => $valueI) {
$meta_data = get_post_meta( $valueI['attendee_id'], Tribe__Tickets_Plus__Meta::META_KEY, true );
$AllEventAttendeesExport[$valueas->ID]['Values'][$keyI][] = $valueas->post_title;
$AllEventAttendeesExport[$valueas->ID]['Values'][$keyI][] = '';
$AllEventAttendeesExport[$valueas->ID]['Values'][$keyI][] = $valueI['security'];
$AllEventAttendeesExport[$valueas->ID]['Values'][$keyI][] = $valueI['check_in'];
foreach ($meta_data as $keyMta => $valueMta) {
$AllEventAttendeesExport[$valueas->ID]['Values'][$keyI][] = $valueMta;
}
}
}

All the events with event title and ticket details will be there in the below Array.
print_r($AllEventAttendeesExport);

Use some CSV library to export this final result.

Friday, June 17, 2016

Simple way to Exclude Latest Post from the WordPress While Loop

Most of the wordpress developers will usually stuck on some simple issues with the wordpress functions. I have recently got stuck for 30 minutes on this simple issue with the While Loop.

Excluding the Latest Post from the Wordpress While Loop.

First we need to get a simple idea about query_posts() and How it works, and How it affect the loop.

For example
<?php
query_posts('posts_per_page=3&offset=0');
?>
This query will tell the loop to display 3 posts which includes the latest one too. Important point is that this “offset” is doing the Magic.

Your loop code should look like:
<?php
query_posts('posts_per_page=9&offset=1');
// offset=1  will remove the Latest post from our Loop.
if ( have_posts() ) : 
    while ( have_posts() ) : the_post();
 the_title();
    endwhile;
end if;
?>

Hope this will help to save your pretious time.

Wednesday, April 13, 2016

Getting Ready For HTTP/2: A Guide For Web Developers

HTTP/2(HTTP/2.0) – The major second version of Hyper Text Transfer Protocol (network protocol) used by World Wide Web and introduced in 2015 by ‘httpbis’-the HTTP working group.
HTTP 1.1 was replaced by HTTP2 due to the following reasons.
HTTP 1.1 has hard time taking full advantage of all the power and performance that TCP offers.
HTTP clients and browsers have to be very creative to find solutions that decrease page loading time.
HTTP 1.1 is very latency sensitive, partly because HTTP Pipelining is still riddled with enough problems to remain switched off to a large percentage of users etc.
HTTP/2 gives the website a 30% performance gain without a complicated build and deploy process.
The aim behind the introduction of HTTP/2 is
To make the page loading faster – HTTP/2 loads web page elements quicker and more efficiently by using all available bandwidth.
To make resources more efficient.
To give the end user a far better experience.
HTTP/2 is designed backward-compatible with HTTP/1.1,so that developers of HTTP libraries don’t have to change APIs, and the developers who are using these libraries don’t have to change the application code which is working on the basis of SPDY protocol.
SPDY doesn’t replace HTTP, it is a for the protocol and modifies the way existing HTTP requests and responses are sent. It requires support from both the server and the browser connecting to that server.
How HTTP/2 Works
HTTP/2 brings new features such as
  • Multiplexed Streams – eliminates the problem of making the assets such as texts,fonts,images etc into smaller parts and allow them to pass via single connection and reassemble them after they reached the final destination. HTTP/2 reduces the latency with multiplexing.
  • Server Push – Represents a more efficient way to deliver the requested pages to a browser. In HTTP/2, pages which are sent are likely sent without any request. These requested pages go to the browser’s cache, and are available immediately if they’re needed.
  • Compression of header – HTTP headers are those small piece of additional data attached to every request sent. Here in HTTP/2, all the headers are compressed as a block which is sent in unity and if the transfer is finished, the header block is decoded and is given back to the corresponding requests.
  • Textual format replaced by Binary – The extra overhead caused by the textual format is followed by the slow loading of web pages. Binary format doesn’t require any parsing and so no overhead. Binary Frames are known to be the ‘fundamental u
    nit’ of HTTP/2.


Requests for multiple assets on a single host use a single TCP connection in HTTP2
Requests for multiple assets on a single host use a single TCP connection in HTTP/2.
HTTP/2 also offers the following.
Concatenation of Javascript and CSS files : Combining smaller Javascript files and CSS files into a larger file to reduce the total number of requests.
  • Spriting Images : Combining multiple small images into one larger image.
  • Domain Sharding : is the Splitting of Resources Between Hosts.For static assets requests were spread across several domains to increase the total number of open TCP connections allowed by the browser.
  • Inlining assets : Bundling assets with the HTML document source, including base-64 encoding images or writing JavaScript code directly inside<script>tags.
    tags.
The HTTP Action
Once if the website is hosted on a server that supports HTTP/2, the decision of whether to continue optimizing for HTTP/1.1 or to optimize for HTTP/2 will come down to the protocol supported by the majority of the website users. HTTP/2 is backwards-compatible and so don’t need to do anything specific. The decision you need to make is when to optimize for it.
Prior case is to launch the website using a secure connection.
Prepare the website for HTTP/2 as to optimize it.
Check the user statistics of the website and check the percentage of benefit from HTTP/2 for the visitors.
Implement HTTP/2 optimization.
Conclusion:
HTTP/2 is likely to provide significant performance advantages compared to raw HTTP/1.1 and it is an exciting new option for web applications. In general, sites will be more secure, simpler and will load faster.

Monday, November 9, 2015

WordPress plugin for Livedrive reseller API

The ‘Livedrive WordPress Plug-in’ is a  simple, easy to use wordpress plugin for setting up Livedrive cloud storage business using wordpress. The plug-in has been very successful & currently over 300 users are using it. It has been seen that the earlier versions of this plugin has outperformed all other similar competitors and becomes the most widely accepted plugin to run your Livedrive reseller business. For Livedrive resellers, this plug-in is the fastest, simplest, and easiest way to generate more sign ups and thus more income and customers for Livedrive resellers.



Read More : WordPress plugin for Livedrive reseller API integration 3.0 Released!!!


Wednesday, November 4, 2015

Brute Force Amplification Attacks/XML-RPC Pingback Vulnerability against WP xmlrpc

A new type of attack has been reported against wordpress called the BRUTE FORCE AMPLIFICATION ATTACK or the XML-RPC Pingback Vulnerability.It mainly affects the ‘xmlrpc.php’ file.
Brute force attacks are very popular attacks on internet as we are on a server online via protocols such as SSH,FTP etc.This technique allows the attackers to try a large variety of wordpress username and password combinations in a single HTTP request instead of attacking the wp-login.php file which can be easily protected via .htaccess file.
Before going into the details of this attack first you should know about the xmlrpc file.


Read More : Brute Force Amplification Attacks/XML-RPC Pingback Vulnerability against WP xmlrpc