SuiteCRM Database Modified Externally - php

I'm new to SuiteCRM and I've seen many documentation links given for defining custom modules but none could not clarify my doubt.
I have a simple question: Can we modify the SuiteCRM's database externally from a different application (such as inserting records) and see the changes in the CRM?
There should be a way to do this. I have tried doing it but I get the error: "error retrieving this record: this record may be deleted or you do not have permissions to view it".
Can anyone provide a solution?

Yes. Changes made to the dB will be reflected in the app. It sounds like perhaps something wasn't quite right with the changes you made however.
One safer way would be to use the built in REST or SOAP APIs as this will ensure changes are made and also allows things like logic hooks to still be triggered.

Related

Wordpress library / SQL queries to build new frontend?

I have a wordpress installation I'd like to get rid off. It's been constant work over the past year keeping up with various updates and changes and managing differenet plugins. I've realized I don't need that much functionality and would be perfectly happy with static pages. If I manage to drop the installation I could also speed things up a lot and integrate the content more easily in the rest of our site.
I'm trying to find a PHP or Perl package which I can use to easily query the existing WP DB. Basically, I want to keep the DB and throw away the frontend and backend to WP. Then I just want to add a very minimal layer of PHP or Perl code on top to show the posts in the DB including meta data.
In case there is no package that can make this job easier, is there some concise overview of the SQL queries I will need? I know I can go digging for them in the codebase, but maybe there is someone who has already done this. Googling around didn't immediately turn up useful results.
Maybe you want give a try to jekyll or octopress.

Additional tables in WordPress database

I am using WordPress and I would like to develop more services for my website. I am thinking of creating new tables inside WordPress database. Will this approach work? I don't want WordPress to delete my tables while updating etc.
These services will be on separate pages, they will not be WordPress plugins. I just want to use the WordPress database to store my tables.
As referenced by a WP Tech Ninja (Samuel Wood, aka Otto) in this post on wordpress.org, you can safely add tables to the Wordpress database and it shouldn't be an issue for upgrades or maintenance.
Adding new tables is fine and several plugins do just that. Twitter Tools, for one.
[...]
Upgrading can modify the database, but if you're using some other table entirely, that table won't be touched by WordPress. It only looks at its own tables.
Don't do this.
I actually got a chance to speak with Matt Mullenweg a few years ago and he advised to avoid any plugin that adds tables like the plague, for the following reasons:
Use the option table(s) (wp_options or wp_N_options for multisite) to store your data—that's what they are there for. They are basically key/value so you can store pretty much anything you want in there. By doing that, you also get the benefit of being able to using the Wordpress api's simple calls to read and write your data, so you don't have to mess with writing data handlers.
Automatic cleanup when your plugin is removed is much easier as well, as you can—again—use the API and those functions are handled for you (yes, there are hooks to tell when this happens for this very reason). Removing tables manually is a pain and is difficult to do when your plugin gets uninstalled.

php hook run functions

I am thinking of building some kind of "hook" function system. Basically a couple of functions that is run before the whole application start doing what it is suppose to do. I guess some kind of authentication would be proper to have as a hook. Check if the user is still logged in etc. There should also be some kind of priority order.
But how do I structure this kind of hook system? How do I initialize it?
I guess I would need some class to handle this for me. An add_hook and run_hooks method or something.
phpBB, the open source bulletin board software, has a hook system you might benefit from looking into. Of course much of the code will be specific to phpBB's framework, but the basic idea would be the same, I think.
I achieve this by using the auto_prepend_file directive of the php.ini file. In my case, it's functions/init.php, which does such things as connect to the database, get user data from SESSION, authenticate, update user's info if needed, etc. etc.. Sounds like just what you need.

Adding /Editing / Deleting existing code using an install script in PHP

I have wanted to create a PBBG creator. (Primarily text based games) However, I couldn't think of a system that efficiently allowed people to have the base code, then install modules into the game adding new features.
For example, the base code would consist of a simple home page and bare bones admin panel. Then you would install a registration module which would add new code and new database tables and a login module that would use the registration module's tables. Then from there you could install a Stats Module adding Health, Mana, etc., that would add more columns in the database for users. This would go on till you had a fully operating game made up of several different modules made by several different people.
What I want to know is if this idea is a good one. What are some issues that might appear? And how would I go about making it easy to add, edit, and delete code. Like if a Combat Module had a Module that modified the combat system, how would I go about determining what to change from an install script?
Also, are there any other open source projects using this system I can study to grasp the idea better.
I hope I explained everything well enough, if not please let me know so I can correct that. :)
Thanks!
It seems like you're describing code generation. If your question, then, is whether this is a good idea or not, code generation is a widely accepted "pattern" and should not be considered harmful.
Modifying existing generated code would increase complexity significantly, so what you probably want is some sort of intermediate representation of the code between when the user configures the PBBG and when it is generated. The intermediate representation should be a easily-modifiable full description of the system - modifying this would be a lot easier than writing a script to parse existing code and edit that.
Hope this helps, and good luck!

Looking for a easy integration PHP forum

I'm building a website with codeigniter (PHP) and I'm looking for a forum easy to integrate with my current database so users don't have to register twice. Moreover, I need to use the same html head and styles that in my website, placing the forum inside a div of <body>
Could anyone recommend me any simple forum application for my situation? Thanks.
I'm not aware of CI-specific solutions, but I've used a couple times MyBB and I can say it's really easy to integrate anywhere, as (at least in the 1.6 release, I haven't use it for some time) it's structure is easily moddable. I integrated it in a Joomla! website and in a custom one, and in both ways it's just a matter of reading the mybb_users table for access; it's quite a detailed table, so you can find almost anything you need for a registration table, like salt,password,timestamp of registration,email, and so on, so you just need to query that table and you're set.
As for the integration with CI I think the best way would be to place the whole forum folder and access it there; for the header, footer and other website parts you just change the relative forum template (layout are divided into subsets of templates, so you can change it easily and in details) and the user would not notice they are different applications.
You can also try and build a CI library for communicatin with the forum; they don't have an official API, but in functions.php and a couple other files I don't remember now (yes, 1.6 was mostly procedural, hope they have changed it now) you'll find all the relevant MyBB core, so building an API is straightforward; I once built own for Joomla! and was really easy. Moreover, there's This guy who wrote an integration for MyBB which is, in fact, a nice API; I don't know how updated it is, just check, but It's not difficult to port those files to a Codeigniter custom library, in case.
For database integration you're not going to find a forum that uses the same DB architecture as CodeIgnitor. What you can do, however, is alter your PHP registration scripts (for both CodeIgnitor and your forum) to add an entry in both member records.
Depending on your database you can also use Database Triggers to automatically update the other table when one is updated.
As for your layout, anything can be modified. Open source options will be the simplest, so I'd recommend phpBB for simplicity sake.
For more information on Database Triggers in MySQL, see here: http://dev.mysql.com/doc/refman/5.0/en/triggers.html
I would suggest using PHPBB forum or Wordpress with the BuddyPress plug-in.
I'm not quite sure how the integration with your codeigniter would be, but seeing as PHP is open-source, it shouldn't be too hard to crack open and find out.

Categories