Post to a user wall and post comments - php

I am using mobile application (html, jQuery, php) to interact with JomSocial and I have been able to post to groups, discussions and more. The way I do this is look at the controller through the url and go to the actual controller class e.g. /controllers/groups.php and see how it's implemented. So when I see www.mysite.com/groups/1, I know the controller is groups.php
The problem am having is that user's profile is not like this. The url looks like
www.mysite.com/1200-victor-gee-fred/profile
I assumed this would be profile.php but nothing like posting to a wall in that class.
Question: What controller is handling the display of user profile? If you also know how I can post on a profile wall and post reply/comment to it, I will appreciate this.
I know these tables are involved: _users, _wall, _actvities etc. But
the sequence of saving into those tables is what I don't want to miss
and have been successful with other entities except user's profile
wall.

In case somebody might need this in future, I finally found the controller.
components/com_community/controllers/system.php
These functions were used
public function ajaxStreamAdd($message, $attachment) - goes into jom_community_activities table
where $message is the text entered in the "Share" box and $attachment is a JSON-encoded string that contains the target, actor, access-level, app etc
public function ajaxStreamAddComment($actid, $comment) - goes into jom_community_wall table
where $actid is the userid of the user posting the $comment
Best Regards

Related

Laravel custom urls saved in database

I want to give custom urls to members of my site to have their pages under my site url like www.mysite.com/{theirurls}.
In database in user table i have a field userurl that keeps the url i give them.
In route i have written the code
Route::get('/{fpage?}', 'AController#fofpage');
In controller in fofpage function i take the variable and look for the value in database. If it belongs to someone redirects to this. If it isnt goes back to / (root).
The problem is that all the other urls like login and others doesnt work.
How can i solve this problem?
Thanks in advance
Put this route at the end of the web routes file to make it work:
Route::get('/{fpage?}', 'AController#fofpage');
You'll also want to validate user URLs and not allow users to enter values like login, register etc.

Best way to get data from non-admins internal to an organization in Wordpress

Here's the scenario:
I want to display a music playlist for each DJ at a radio station on my Wordpress site, but I don't want to have to enter that data in (Each song, artist, album, etc), in a specific custom post type or something like that.
I want each DJ to have access to a form where they can enter the playlist data in, and I can use that data. I was thinking of making a little webpage form that they can access, and then I query the database to get all that stuff, but I imagine that maybe there is an easier way using Wordpress.
The thing is, I don't want to give each DJ admin access to make posts with those custom fields filled in, so I'm not sure if there's a way to do that.
Maybe a page on the website that is password protected to fill out the form, and then I can use that data in a different page on the site? (Password protected so I'm only receiving data from actual DJs, not random people or bots.)
Sorry if this is an ignorant question, or if I'm unclear.
I searched a little bit, and couldn't find much.
Thanks in advance for ideas and insight!
You need to decide your method for doing this and try it out, when you run into a problem then you post here. It sounds like you know what you need. You're looking for a password protected form (which will check against a database) and pages based on a query to the database. This can be done in PHP or you might be able to find a Wordpress plugin to help you out.
Maybe start by making the PHP form. Then you could add the password protection. After you have that working you could make the PHP page that would query the information submitted. Take it one step at a time. It'll be much easier for people to help you if you're troubleshooting a specific issue rather than trying to figure out the logistics of how the whole system will work.

codeigniter - hide variable from url

I want to do something very simple in codeigniter. I have a view, which contains several person profiles. Each person profile has contact button and it should go to a contact form which sends an email to the chosen person. So I have tried something like this:
Contact
And this is OK, but I do not want the email to be visible in the URL. Is this possible ?
Yes, it is possible. Use an array inside your controller:
$emails = array(0=>'email1#website.com', 1=>'..', 2=>'');
Your link would be
Contact
And then do something like this: email_to($emails[$email_index])
Well, you get the ideea.
If you don't want data to be visible in the URL you should not use GET. Instead take a look at the POST method. But if the problem is that you don't want to show just the e-mail, maybe you could pass an user id (or other variable that is unique for each user) in the URL, and use it to fetch the e-mail on the contact page.
(Please note that just because the POST data is not immediately visible in the URL field, it is not completely invisible. POST data can be easily displayed in different debugging tools.)

How can I send data from one page to another using Laravel?

So I'm using laravel 5.1 and I'm stuck in a weird situation.
I have 2 models Seasonand Tournament and lets say the url to add a Season model is ..../seasons/add and to view the season would be ..../seasons/(id)... standard stuff right?
But now I want to add a tournament from the link ..../seasons/1 and so I click a link that takes me to ..../tournaments/add... how can I send the Season model to that page without submitting a form with hidden input?
Currently I have this setup ..../seasons/1/tournaments/add using blade to generate the links. But this method just doesn't feel right....
Thanks.
How can I send data from one page to another using Laravel?: I would suggest that you do this from your controller. Take a look at Redirecting With Flashed Session Data, it might come in handy.
From the Flash Data documentation: "[...] it will only be available during the subsequent HTTP request, and then will be deleted [...]"
You can send your model, static values or whatever you want using ->with:
redirect('route')->with('key', 'value');

Is there such a thing as a partial domain model?

I’ve built a PHP ‘personal profile based’ website that has a number of ‘Category’ pages, each of which list a number of Profiles.
Category page: Lists profiles (images/names in a gallery-like layout)
Profile page: Shows in-depth information about one person/profile
Im using a kinda-MVC-esque architecture here. So, when a visitor goes to a Profile page, the appropriate Controller asks the ProfileDataMapper to fetch the relevant profile. The ProfileDataMapper returns a fully formed Profile Domain Object to the Controller which then sends it to a Template View.
The domain objects are all populated from arguments to their constructors, and have validation checks in them so that if any arguments are missing or bad, they will throw an error and not be instantiated.
The problems start when I want to list a number of Profiles on a Category page. Here I am asking the DataMapper for an array of Profiles. But it is returning a list of whole complete Profile Objects when I know that in this case I only need perhaps a Name and URL. It is putting too much strain on the MySQL DB behind the mapper.
The obvious solution would be to simple make the DataMapper pull just the few fields I really need for the list. But then my Domain Model validation tests would fail due to missing data (they are expecting all fields).
So now I am thinking I should create a new Domain model called PartialProfile or ListableProfile. This domain model would just have a name/url and would only validate those two fields. The ProfileDataMapper would return PartialProfiles in its list method instead of Profiles. Maybe the Profile could even extend from PartialProfile.
Is this 'partial model' a good way to go? Or should I refactor my validation code somehow? It seems to me I need different 'levels' of validation. Sometimes I need the object with all data. Sometimes I don't.
Thanks kind people!

Categories